Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Struggling with some equations here. I've got a particle I need to track in an absolute reference frame, but each step I move/rotate it relative to its own reference frame. I need to track it's absolute position while moving it relatively.

I'm trying to figure out the proper set of rotation matrices. It propagates along the x-axis and I can describe its current direction with [ux, uy, uz], now I need to rotate it about it's own reference frame by the deflection $\theta$ (deflection from incident direction) and azimuthal rotation $\phi$ (rotation about incident direction), and then find its new position, [ux', uy', uz']. Should I multiply by the rotation matrix, ROT[y,$\theta$], then ROT[x,$\phi$] or the opposite order?

I'm just getting myself confused. By way of reference, I'm trying to derive the set of equations on (pdf) page 20 of this document.

It's a) not derived very well and b) derived for propagation along the z-axis, not the x-axis.

TL;DR - I have a vector in space pointing in an arbitrary direction, described by its projections on the world x,y,z-axis. I need to rotate the vector, in relation to its own reference frame, and find the world axis projections. Essentially this is a ray-tracing problem. Incoming ray needs to point in a new direction - what is that direction?

share|cite|improve this question
What do you mean by "It propagates along the x-axis and I can describe its current direction with [ux, uy, uz]"? If it propagates along the x axis, why isn't its current direction [1,0,0]? – joriki Feb 7 '11 at 22:45
joriki, sorry, it originates by propogating along the (world) x-axis - but after several movements, it doesn't stay there. But, deflection ($\theta$) is in reference to the local x-axis and azimuthal rotation $\phi$ is rotation about this axis. – gallamine Feb 8 '11 at 13:33

Let $R$ be the rotational matrix which has the axes of the local frame, represented in the world coordinates in its columns. This means that $R$ as a matrix maps directions from vectors expressed with projection in the local frame to world space. Let $T$ be the rotation you have to apply, which is written in the local coordinates. What you do is: you transform to the local coordinates (inverse of $R$ does that), do the rotation, and go back:


Transpose equals inverse for rotational matrices.

Of course, this maps directions. If you want to map positions, you also need to undo translations, do everything, and then put the translation back (if your frame is not centered in the world coordinates).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.