Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

pr0teus

Rotation

This topic is 6519 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

Hey, I know two pieces of information. The vertices of my triangles and their normals. How, then, using this data, can I find the rotation values necessary to rotate vector A (0, 0, 1) so that it points in the same direction as vector B (the normal)? Thanks in advance, Ben

Share this post


Link to post
Share on other sites
Advertisement
If A and B are unit vectors then the dot product of A and B is the cosine of the angle between them. It is actually the magnitude of A times the magnitude of B times the cosines of the angle between them, but the magnitudes are one for unit vectors.

Share this post


Link to post
Share on other sites
I know the dot product is the angle between them. But that doesn''t tell me what the rotations were that made the normal face that way. (ie, is the rotation on the x axis? y axis? a combination of x and z?)

Ben

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by pr0teus

I know the dot product is the angle between them. But that doesn''t tell me what the rotations were that made the normal face that way. (ie, is the rotation on the x axis? y axis? a combination of x and z?)

Ben




Well, if you take the arccos of the dot product, that''s the angle. And the cross product of the two vectors is the axis of rotation. Now you have an axis of rotation and an angle, which you can convert to angles.

Share this post


Link to post
Share on other sites

  • 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!