# Velocity vector transformations with respect to a global frame of reference

This seems like it should be a simple problem, but I've been stuck on it for about a day now. It's technically a programming problem, but I'm posting it here because the root of the problem is really mathematics.

I have an object moving in a 3D space. This space has three coordinate axes and these are global axes, and space is the global reference frame. The object also has three coordinate axes and these can be in any orientation in respect to the global frame as the object is rotated.

Q: If I apply a velocity vector in respect to the local frame, how can I find the equivalent vector in the global frame?

Given:

A quaternion describing the rotation of the object in 3D space.

A vector position for the object in space.

A vector velocity that I want to add to the position over time.

I have a feeling the answer is really simple and I'm just thinking of it the wrong way. Thanks for your help.

• Apply a velocity? What does that mean? Is this a physical problem with some applied force (acceleration)? Or, can you write an equation for the object's velocity vector (either with respect to its local frame or the global frame) as a function of time? – Muphrid Jan 3 '15 at 4:43
• I can write it with respect to time. As I said in the question, but didn't really elaborate on, is that the object is part of a computer program I'm working on. Every frame has a time and the object doesn't have any acceleration, just constant velocity. Every time the frame updates, the object gets moved that much further. The problem is that the velocity vector sees the object's rotation as its local reference, but I need to know what that vector looks like in reference to the global frame. – Nathaniel D. Hoffman Jan 3 '15 at 5:21
• Constant velocity in the object's intrinsic frame? Or constant velocity with respect to the global frame? – Muphrid Jan 3 '15 at 5:23
• The constant velocity is in respect to the object's intrinsic frame. I'm trying to find the equivalent velocity in respect to the global frame. – Nathaniel D. Hoffman Jan 3 '15 at 5:35

• Find an expression for $v$ as a linear combination of your body basis vectors, $b_1, b_2, b_3$.
• Determine the linear map $R$ that relates the global basis vectors ($g_1, g_2, g_3$) to the body basis. For instance, let $R(g_1) = b_1$, and so on. This should be determined by your quaternion.
• Let $w = R^{-1}(v)$ and write $w$ in the global basis. $w$'s components in the global basis are the same as $v$'s components in the body basis, so you don't actually do any matrix inversion here. (Note: I include this step to be pedantic; a programmer would probably not even make note that this is done, or that there is even a distinction between $v$ and $w$. You could do this step without actually writing any code.)
• Compute $v = R(w)$, with $R$ described in the global basis. This gives you $v$ in the global basis.