Archived

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

billybob

rotating a point around another point?

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