Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

A simple question on rotation

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1 yasmin_bd   Members   

121
Like
0Likes
Like

Posted 24 January 2013 - 01:32 PM

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?



#2 Brother Bob   Moderators   

10276
Like
0Likes
Like

Posted 24 January 2013 - 01:46 PM

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.



#3 yasmin_bd   Members   

121
Like
0Likes
Like

Posted 25 January 2013 - 11:02 AM

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.



#4 yasmin_bd   Members   

121
Like
0Likes
Like

Posted 25 January 2013 - 02:50 PM

Could you tell me how to find out the corresponding rotation matrix?



#5 yasmin_bd   Members   

121
Like
0Likes
Like

Posted 25 January 2013 - 05:02 PM

I understand how to convert from axis angle to matrix from wiki.http://en.wikipedia.org/wiki/Rotation_matrix
 






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.