PDA

View Full Version : Rotate a vector around another vector?



halo
03-17-2006, 06:35 PM
If I have vector A, and I want to rotate it n degrees around vector B, what is the equation for this?

Ax#,Ay#,Az# is pointing somewhere.

Bx#,By#,Bz# is an axis I want to rotate vector A around by n degrees.

CrazyButcher
03-18-2006, 12:19 AM
this is more something for the maths subforum here...

but at http://skal.planet-d.net/demo/matrixfaq.htm
you will find how to construct rotation matrix for angle,axis and then transform the vector A with that matrix

halo
03-18-2006, 05:53 AM
Didn't realize there was a math forum.

I'd like to do this without a matrix. I'm sure it's possible.

CrazyButcher
03-18-2006, 06:36 AM
well you can always "compress" the operations that are done to turn the angle axis to matrix and those which transform the vector with that matrix to just one operation.