# The difference between local and world rotation

#1

Hi all,

Bit of a maths question here for you…

Imagine you were stood in the positive Z direction, and your feet were facing outwards (like a ballet dancer) with your right foot pointing negative X and your left foot positive X. The rotations of your right ankle would result in the following:
Z rotation - the amount of elevation (-Z elevating you higher onto your tip-toes)
Y rotation - the amount of turnout (90deg pointing your toe directly along the X-axis)
X rotation - twisting your foot forwards and backwards

Now imaging your feet were not aligned directly along the X-axis with the Y rotation being at around 45deg (ten to two).

If you use the rotate tool at the ankle on a joint chain replicating this setup in world mode, the foot bone falls between the X and Z rotation axis. If you switch to local mode, the Z rotation lines up nicely with the foot bone, the X axis lines up nicely with the foot twist and the Y axis lines up nicely with the foot turnout.
The rotate XYZ values in the channel box for the ankle joint however are all affected when you change the turnout or elevation, and only the foot twist affects only the rotateX.
I am aware that these are the world rotation values which are displaying and there must be some underlying maths which calculates this based on the local rotation.

From what I can gather, this calculation may be based on Euler angles. Perhaps it is matrix algebra or something more geometrical?

If anyone has any ideas as to the maths behind it or can direct me towards a solution it would be much appreciated.

Andy

#2

Without getting too much into linear algebra, basically you can build rotation matrices for pitch, yaw, and roll. Taking the product of these 3 matrices, you can obtain the matrix for euler rotations. After that, you can construct the matrix/vector equation A*r=r’. Basically, this could be used calculate the direction the vector r’ is pointing in from the vector r. A somewhat similar process can be used in calculating rotation angles. You’re basically changing the directions (vectors) of local rotation axes, into what can be expressed as a linear combination of the original three. Further rotations repeat this process. It should be noted, however, that rotations are not commutative operations, as translations are. It’s because of this that keeping track of rotations in world space is good, because given a rotation order (xyz typically), it is easier to compute following rotations. Calculating inverse matrices is important to converting between rotations. Look up pitch, yaw and roll matrices to see the math. If you’ve had any linear algebra/understand how matrices work, you shouldn’t have any issue understanding.

I’m having trouble understanding what issue you’re having though, so I’m not entirely sure what problem you’re trying to solve.

#3

That’s really helpful thanks. I’m afraid I don’t have any experience with linear algebra and very little with matrices, but I do kind of get the principles of what you say and have come across the pitch, yaw and roll while I’ve been trying to make sense of all this.

What I’m doing is looking at ballet posture and joint alignment. When the dancer is in first position, demi-pointe or en pointe (defined by the elevation described in the previous post), if the foot is not correctly aligned with the lower leg (foot twist in the previous post) it can lead to long term injury. When the joint chain is setup as described earlier with no elevation, it is easy to see the degree of misalignment in the rotateX value. However as elevation is added the rotateX value changes so you are not starting from 0. As you describe the local rotation axis changes and the Euler rotation calculations kick in.

What I’m trying to do is calculate what the degree of misalignment is (foot twist in X) regardless of where the foot is elevated or at what degree of turnout.

Does that make sense?

#4

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.