Sign in to follow this  

how to get rotation vector from 2 positions

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

hi, i rotate p(x,y,z) around z-axis by an angle of rz; then around x-axis by rx; then around y-axis (BVH channel's order) by ry. Finally, i get p1(x1,y1,z1). Question: given p and p1, what's the formula to calculate the rotation vector r(rz, rx, ry)? thank!

Share this post


Link to post
Share on other sites
So essentially you have two vectors and you're trying to find out to rotation around each axis. Well, the answer is not as clean cut as you might think because there are a large number of ways you can do this. For example, you can get a rotation around each axis in the order of X, Y, Z. But if you get it in the order of Z, X, Y, it will still be valid but your values will be different. Same in the order of Y, X, Z, and so on.

Take a look at these links, they might help:
http://www.euclideanspace.com/maths/geometry/rotations/axisAngle/index.htm
http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToMatrix/index.htm
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm

Share this post


Link to post
Share on other sites

A direct answer to this will be difficult to find, since in general rotations aren't expressed as a vector with angles around the axes (called Euler angles). The main problem with what you're asking is that an infinite number of possible angle combinations (counting Mod2Pi ones) will rotate p to p1, all but one of which you probably don't want.

Perhaps there is some way to get the angles you want, but I don't know of it. If you're looking for some arbitrary angles, you could find them by projecting p1 and p onto the appropriate planes and solving with some basic trigonometry. To get the rotation around the z axis for example, you would take the xy components of p1 (a 2D vector) and find its angle with the xy components of p. Rinse and repeat for the other axes.

I don't know if that works for you, but in any case you might want to take a look the rotation representations and conversions RealMarkP proposed. Matrices and quaternions are typically more useful (and stable) than euler angles.

Share this post


Link to post
Share on other sites
thanks a lot! i think i can use mathematica to solve a equation R(rx)R(ry)R(rz)P1=P2, where R is rotation matrix. mathematica should solve all the possible rx,ry,rz for me.

Share this post


Link to post
Share on other sites

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