Rotating a set of anges (pitch/yaw/roll) by another set of angles (pitch/yaw/roll)

2k Views Asked by At

I want to rotate a set of angles (pitch/yaw/roll) by another set of angles (pitch/yaw/roll). By using Google I only found information about rotating a vector by angles, which is not what I need. Examples: (disregarding signs)

- (0/90/0) rotated by (90/0/0) -> (90/0/90)
- (0/0/90) rotated by (90/0/0) -> (90/90/0)

For simplicity I just created examples with angles of 90°, but I am looking for a method that can also do this with odd angles. What method works for this? Is this possible to do with rotation matrices?

2

There are 2 best solutions below

2
On BEST ANSWER

This is a problem that 3D animation software has to deal with all the time, namely when an object's coordinate system is related to another object's coordinate system rather than the global coordinate system. In the general case, there may be arbitrarily many such coordinate systems each adding their own pitch/yaw/roll to each child object.

The solution used by Blender (https://www.blender.org) is based on Quaternions. Wikipedia explains how quaternions work in this case: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation. That explanation is perhaps too lengthy to be copied here (though it can be if that's the only way to validly "answer" the question).

2
On

It's impossible to do with rotation matrices (and arguably impossible to do at all). Why? Here are two pitch-roll-yaw sequences:

A = (180/180/180)

B = (0/0/0)

They amount to exactly the same thing (don't move at all).

Why is this a problem? Suppose you do $A$ twice. Of course, the result is still "don't move at all". But should the answer to your question be $A$ or $B$? Both are correct. And because of that, it's likely that no single clean procedure will produce a continuously-varying output as you continuously vary the two inputs.

What about the claim about matrices? Well, the matrices corresponding to $A$ and $B$ are both the identity, so you definitely can't distinguish them.

BTW: This is closely related to the problem of gimbal lock, which plagues many mechanical systems.