Compute the transformation based on selected local coordinate system

You can represent a transformation (translation and rotation) in a non-ambiguous way, using a 4x4 homogeneous transformation matrix.

There are then many ways how to decompose this matrix to a series rotations and translations. Rotation can be decomposed by using many variants of Euler angles, Roll-Pitch-Yaw, etc. You can use one method that is available in VTK or look up other conversion formulae on Google. The problem with these representations that they are ambiguous and unstable (suffer from gimbal lock), so you need to choose the rotation axes order very carefully, in a way that it makes the most sense and it is the most stable for your application.

1 Like