*2.3. Conversions*

A method to convert a rotation from one definition to another is to calculate the rotation matrix representing the rotation and use this matrix to calculate the parameters of the desired definition. To that end, methods will be given to convert the common definitions into matrix form and back. Figure 4 shows an overview of the conversion paths introduced in this paper. The conversions are first given for intrinsic and extrinsic rotation sequences. *2.3. Conversions*  A method to convert a rotation from one definition to another is to calculate the rotation matrix representing the rotation and use this matrix to calculate the parameters of the desired definition. To that end, methods will be given to convert the common definitions into matrix form and back. Figure 4 shows an overview of the conversion paths introduced in this paper. The conversions are first given for intrinsic and extrinsic rotation sequences.

*Materials* **2021**, *14*, x FOR PEER REVIEW 6 of 16

spect to the femoral axes as a Cardan XYZ-sequence.

**Figure 4.** Overview of transformation paths between different descriptions of patellar rotations. **Figure 4.** Overview of transformation paths between different descriptions of patellar rotations.

2.3.1. Rotation Sequences 2.3.1. Rotation Sequences

With the standard uniaxial 3D rotation matrices Rx(α), Ry(β) and Rz(γ) for the rotations around x, y and z, the rotation matrix R of the full 3D rotation can be calculated by matrix multiplication. For an extrinsic rotation sequence, the resulting matrix R is the matrix product of the corresponding uniaxial rotation matrices, expressed in the opposite sequence order from left to right. For an intrinsic rotation sequence, the order of the uniaxial rotation matrices is inverted. For example, the rotation matrix R = Rx(α)∙Ry(β)∙Rz(γ) represents the extrinsic rotation sequence ZYX and the intrinsic sequence XYZ. It is important to note that this method works the same for Euler angles. With the standard uniaxial 3D rotation matrices Rx(α), Ry(β) and Rz(γ) for the rotations around x, y and z, the rotation matrix R of the full 3D rotation can be calculated by matrix multiplication. For an extrinsic rotation sequence, the resulting matrix R is the matrix product of the corresponding uniaxial rotation matrices, expressed in the opposite sequence order from left to right. For an intrinsic rotation sequence, the order of the uniaxial rotation matrices is inverted. For example, the rotation matrix R = Rx(α)·Ry(β)·Rz(γ) represents the extrinsic rotation sequence ZYX and the intrinsic sequence XYZ. It is important to note that this method works the same for Euler angles.

The formulas for calculating the angles α, β and γ for a specific sequence from a given rotation matrix R\* with the entry Rst\* in line *s* and column *t* are obviously dependent on the sequence. Rotating around a particular axis twice within one sequence leads to angles that are hard to interpret clinically. Only the equations for Cardan angles are therefore given here.

For certain sequences, the following method is often shown in literature (e.g., intrinsic XYZ-sequence [32,42]). Here, a general formulation which can be used for any sequence, will be introduced.

Let (i,j,k) be a tuple of three different indices with (i,j,k) ∈ {1,2,3}. Then every (i,j,k) tuple represents a Cardan sequence (e.g., (i,j,k) = (1,3,2) stands for the sequence XZY). To calculate the angles of the patello-femoral rotations, the sign sgnijk of a sequence tuple is needed. The sign is equal to 1 if the tuple (i,j,k) can be created from the tuple (1,2,3) by an even number of transpositions. If the number of transpositions is odd, sgnijk is equal to −1 [43]. The equations

$$
\varphi\_{\rm i} = \arctan2 \left( \mathbf{R}\_{\rm kk} \mathbf{^\*} \mathbf{\_} - \mathbf{s} \mathbf{g} \mathbf{n}\_{\rm jk} \mathbf{^\*} \mathbf{R}\_{\rm jk} \mathbf{^\*} \right) \tag{1}
$$

$$\boldsymbol{\varrho}\_{\text{j}} = \sin^{-1} \left( \text{sgn}\_{\text{ijk}} \cdot \text{R}\_{\text{ik}} \, ^{\ast} \right) \text{ and} \tag{2}$$

$$
\varphi\_{\mathbf{k}} = \arctan2 \left( \mathbf{R}\_{\mathbf{i}\mathbf{i}}\mathbf{^\*} \mathbf{\_}-\mathbf{s} \mathbf{g} \mathbf{n}\_{\mathbf{i}\mathbf{k}} \mathbf{\cdot} \mathbf{R}\_{\mathbf{i}\mathbf{j}}\mathbf{^\*}\right) \tag{3}
$$

directly lead to the sought angles for flexion (α = ϕ1), spin (β = ϕ2) and tilt (γ = ϕ3). The proof for Equations (1)–(3) is given in the Supplementary Materials.
