three.js - Drawing lines between the Icosahedron vertices without wireframe material and with some line width using WEBGLRenderer -


i'm new threejs need draw sphere connected triangles. use icosahedron construct sphere in following way

var material = new three.meshphongmaterial({      emissive   : 0xffffff,      transparent: true,      opacity    : 0.5,      wireframe : true  });  var icogeo = new three.icosahedrongeometry(80,2);  var mesh = new three.mesh(icogeo, material);  scean.add(mesh);

but need width of line more line width won't show in windows taught of looping through vertices , draw cylinder/tube between vertices. (i can't draw lines because linebasicmaterial not responding light.)

for(i=0;i<icogeo.faces.length;i++){      var face = icogeo.faces[i];      //get vertices face , draw cylinder/tube between 3 vertices              }

can 1 please on drawing tube/cylinder between 2 vector3 vertices?

**the problem i'm facing wireframe was not smooth , can't increase width of in windows.

if want create cylinder between 2 points 1 way create in unit space , transform line. mathy.

an intuitive way create think how in unit space? circle around z axis (in x,y) , 1 bit down z.

creating circle in 2d easy: ( angle(0,360,360/numsteps) ) (x,y)=(sin(angle),cos(angle))*radius. (see example calculating position of points in circle).

now 2 butt ends of cylinder not in x,y! if have 2 vectors dx,dy can multiply x,y them , 3d position!

so how dx, dy? 1 way http://en.wikipedia.org/wiki/gram%e2%80%93schmidt_process reads way more scary is. start forward direction, line. forward = normalize(end-start). pick direction "up". (0,1,0). unless forward close up, pick 1 (1,0,0). take cross product. gives "left". take cross product between "left" , "forward" "right". "left" , "right" dx , dy!

that way can make 2 circles @ 2 ends of line. add triangles in between , have cylinder!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -