# Drawing a cylinder

This topic is 3668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I would like to draw an openfaced (i.e., no ends) cylinder with radius R, with the center of one face at the origin, and the center of the other face at an arbitrary point (x,y,z) (i.e., having length sqrt(x^2+y^2+z^2)). I know how to draw the cyclinder using a GLUquadricObj. What I need help with is with the transformation to get it there. Thanks for any suggestions! tfhain

##### Share on other sites
What you need to do is find the angles (x axis rotation and y axis rotation) from point A to point B and use those rotations (if you can dig up some old trigonometry text books or something, they'll help a lot). The center of it will be (point A + point B) / 2.

If you basically take any 'look at' function, they should be able to provide you with the necessary rotation values. I wrote my own ages ago, and while I would provide you with that code, it's not pretty...

##### Share on other sites
Hmm... doesn't help much, but thanks anyway, mate.

tfhain

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633696
• Total Posts
3013394
×