Graphics : How to create a 3D cylinder around a line segment in opengl? -


i have line segment 2 end points, wanted create cylinder around radius r.

there enough examples on web, here's simple description. think of cylinder cd-rack. consider "bottom surface" of cylinder. know center of surface 1 end of line segment. edge vertices of surface, vertices of group of triangles (say 8) made 1 vertex center of surface. make cylinder complete, make stack of such surfaces till other end of line segment.

how find vertices of each line intersecting surface (ex, there 8 lines in below figure) ? loop goes this:

for(each line) {     float angle_degrees = 360 * (id of line) / (number of lines);      float x = radius * cos(angle_radians);     float y = radius * sin(angle_radians); } 

zwiggler drawing:

enter image description here

some other discussions on subject: number of sides required draw circle in opengl


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -