Well, you'd think it would be easy: rotate a point (*x*,*y*,*z*) around a vector (*u*,*v*,*w*), by a certain angle λ. You'd think this would be in every elementary graphics textbook, but no.

For true 3-D applications, you'd probably want to use a transformation 4x4 matrix and perhaps quaternions (seach) This is for quick and dirty, "I need to rotate-something-now" type of work where you don't have a matrix library laying around. Like in javascript, or python. An application of this is to be able to draw circles on Google Earth (posting to come).

Glen Murray solved this in the most general case with the new point being:

Which is not so bad. However if we assume the vector is a unit vector, (and there is no reason not to assume this since we always do a little translation and scaling), the result is much simpler:

I'll post the derivation shortly.

Comment 2007-12-08 by None

Or, in other words, the rotated vector is equal to

U times (U dot X)(1 - cos lambda) + (U cross X) times (sin lambda)

where U is the normalized form of (u,v,w) and X is (x,y,z). Thanks though :)

Comment 2008-04-02 by None

Aha! I was delighted to find this "vector" solution posted here, but when I tried it gave the wrong answer. I Googled and found the correct form of this "Rodrigues" equation posted on Wikipedia:

X times (cos lambda) + U times (U dot X)(1 - cos lambda) + (U cross X) times (sin lambda)

Notice the additional first term. But thanks, stijn, for pointing me in the right direction to solve my geometry problem.

Comment 2008-07-20 by None

I have to agre with the one that anonymous posted. If you visualize it, it makes sense. The first two use cosine to interpolate between X and where X would be if rotated 180 using U truncated (by the dot) as the center point. The last term shifts it on the perpendicular axis using sine. Beautiful! However, when I searched wikipedia for Rodrigues equation I got nothing like this.

Comment 2008-07-30 by None

I am the "anonymous" that said Wikipedia had Rodrigues equation defined. You can see it at http://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula. I didn't bother going through the proof on that page but simply used the equation at the top of the page. Incidentally, I figured out the notation (u,v) in the third term to the right of the equal sign means dot-product.