Jump to content
  • Advertisement

Archived

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

billybob

rotating a point around another point?

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

is there a way to rotate a point around another point with directX? i don''t need it for rendering, but i need to do it somehow. i know the math for it, just kind of dreading it. it would be realy nice if dx had some kind of function just to give it the vector to rotate, the vector to rotate around, and the angles. would simplify code a ton.

Share this post


Link to post
Share on other sites
Advertisement
well if you making anything 3D you should have your own Matrix Code... and a rotation matrix... once you get them its really easy to do rotations...

here is equation for rotation of A around point B by rotation matrix RotMat;

so to rotate Vector A around Vector B by a Rotation Matrix;

A-=B;
A=RotMat*A;
A+=B;

The rotation matrix I use allready have the values set but dont are not multiplied by a vector... which means you can rotate many vectors using the same rotation...





[edited by - crakinshot on July 27, 2002 5:32:54 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why don''t you just you Sine and Cosine? It''s pretty simply:
vector2.x = sinf(angle) * radius;
vector2.z = cosf(angle) * radius;
vector2 += vector1;

Share this post


Link to post
Share on other sites
Why don''t you just you Sine and Cosine? It''s pretty simply:
vector2.x = sinf(angle) * radius;
vector2.z = cosf(angle) * radius;
vector2 += vector1;


When they come for me I''''ll be sittin'''' in my desk with a gun in my hand wearing a bullit-proof vest singing "My, my, my, how the time does fly when you knw your gonna die by the end of the night!"

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!