

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer

Considering that I have a vector A, and after an arbitrary rotation I get vector B. I want to use this rotation operation in others vectors as well, but I'm having problems in doing that.

My idea do that is to calculate the perpendicular vector C of the plane AB (by calculating AxB). This vector C is the axis that I'll need to rotate. To discover the angle I used the dot product between A and B, the acos of the dot product will return the lowest angle between A and B, the angle ang. The rotation I need to do is then: -rotate *ang*º around the C axis.

The problem is that I dont know if this rotation is a CW or CCW rotation, since the cos of the dot product does not give me information of the sign of the angle. There's a tip discover that in 2D ( A.x * B.y - A.y * B.x) that you can use to discover if the vector A is at left/right of vector B. But I dont know how to do this in 3D space. Can anyone help me?

share|improve this question

In 3D it's even easier then 2D as the cross product's direction tells us which way is clockwise. The direction C will be point depends on which way is the smallest angle.

Remember the 'right hand rule'; if the smallest angle from A to B is counter-clockwise, then C will be pointing towards you, if the smallest angle from A to B is clockwise, C will be pointing away.

Looking along C you will need to rotate A clockwise to reach B. Most 'rotate about an axis' functions e.g Rodrigues, will do this automatically. The direction of rotation about an axis depends on whether the axis is 'pointing' towards you or 'pointing' away from you.

So you don't need to mess with getting dot products of normal vectors like you do in 2D. Actually, now that I think about it the dot product of the normal(of A) and B (as similar to the expression mentioned in the question);

also happens to be the Cross product of A & B with the 3rd dimension zeroed. The sign of this expression tells us the direction of rotation of the smaller angle.

share|improve this answer
+1 for your answer .. and funny profile advice :) – teodron Nov 20 '12 at 9:06
Very good answer, didn't notice that :) – user23132 Nov 20 '12 at 12:35

Your Answer


