Jump to content
  • Advertisement
Sign in to follow this  
tfhain

Drawing a cylinder

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!