Sign in to follow this  

Angle between two vectors about arbitrary axis...

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

Look, i have three points, one center point and two another points that's make vectors(they'r have equal length) with center point, and suppose i have some another vector(arbitrary axis), and i need to know angle that rotate one vector to anoterh about this axis. Can anyone help me?

Share this post


Link to post
Share on other sites
Project them onto a plane perpendicular to the axis. e.g. if your vectors are a and b, and the axis is n, then asssuming n is a unit vector

c = a - n * (a . n)
and
d = b - n * (b . n)

lie in a plane through the origin perpendicular to the axis, and the angle between them is the angle you want. They are not in general unit vectors, so to get the angle between them you need something like

arccos ((c . d) / (|c| * |d|))

Share this post


Link to post
Share on other sites
A function that rotates a vector around an arbitrary axis. I can explain it in more detail if you ask.


void RotateVector(float Angle, Vector3 *VecToRotAbout, Vector3 *VecToRotate)
{
float cosTheta = (float)cos(Angle);
float sinTheta = (float)sin(Angle);
Vector3 proj = *VecToRotAbout * DotProduct(VecToRotAbout,VecToRotate);
*VecToRotate=
(*VecToRotate-proj)*cosTheta+
(CrossProduct(*VecToRotAbout, *VecToRotate)*sinTheta)+
proj;
}


Share this post


Link to post
Share on other sites

This topic is 4104 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this