Jump to content
  • Advertisement
Sign in to follow this  
yasmin_bd

A simple question on rotation

This topic is 2152 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 need some clarification about glRotatef function. I have a rectangular plane with normal ax + by + cz = 0;
I would like to rotate it to align along (0, 1, 0) i.e. Y-axis.
I can find the in-between angle by dot product. Suppose the angle is theta in degree. Now how can I use glRotatef function to rotate the plane so that the new normal to the plane is along (0, 1, 0) vector; Is the following ok?
glRotatef( - theta, a, b, c);
If not, what will be the correct version?

Share this post


Link to post
Share on other sites
Advertisement

If the plane equaiton is ax+by+cz=0, then the plane's normal is the vector (a,b,c). You want to rotate from one direction to another, so the axis of rotation in this case is the cross product of the plane's normal and the Y-axis.

Share this post


Link to post
Share on other sites

Thank you, I understand. I need to find the cross product of (ax, by, cz) and (0, y,0) and then use it in glRotatef function.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!