<<

Matrices 2

WCR 2017-04-21

Outline Markers and Measured Orientation Vectors Rotation-of-Points Rotation-of-Coordinate-System Matrix Summary Helical Axis and Simulating Movement with Helical Angles Simulating Movement with Euler Angles Shoulder Joint Hip Joint

Markers and Measured Orientation Vectors

Marker locations are determined in the global (lab) reference system (GRS), using motion capture techniques. These marker locations are used to estimate orthogonal unit vectors iprox,jprox,kprox for the proximal segment and idistal,jdistal,kdistal for the distal segment, at each time point. Since the markers are in the GRS, the unit vectors are also expressed in the GRS. We assume vectors are expressed as column vectors. We also assume that i,j,k of the proximal and distal segments are defined so that they are aligned in the neutral position. Another way of saying this is that the joint angles (flexion/extension, abduction/adduction, internal/external rotation) are assumed to be zero when i,j,k point in the same directions for both segments. (The ankle joint may be an exception to this general rule.)

Our goal is to use our knowledge of the orientations at each time to determine the angles of flex/ext, abd/add, and IR/ER, of the distal segment relative to the proximal, at each time.

At each time, we arrange the orthogonal unit vectors of the proximal and distal segments into two 3x3 matrices. Each column is a unit vector expressed in the GRS:

, , , = ( ) = , , , (1) 𝑖𝑖𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑗𝑗𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑘𝑘𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 , , , 𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝒊𝒊𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒋𝒋𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒌𝒌𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 �𝑖𝑖𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑗𝑗𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑘𝑘𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝� 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝐺𝐺𝐺𝐺𝐺𝐺𝑧𝑧 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑖𝑖 , 𝑗𝑗 , 𝑘𝑘 , = ( ) = , , , (2) 𝑖𝑖𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑗𝑗𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑘𝑘𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 , , , 𝑅𝑅𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝒊𝒊𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 𝒋𝒋𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 𝒌𝒌𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 �𝑖𝑖𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑗𝑗𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑘𝑘𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑙𝑙� 𝑖𝑖𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑗𝑗𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑘𝑘𝐺𝐺𝐺𝐺𝐺𝐺𝐺𝐺 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 Rotation-of-Points Matrix

The that will move the vectors in the proximal segment into alignment with the distal segment is Rp2d :

= (3)

𝑝𝑝2𝑑𝑑 𝑝𝑝𝑝𝑝𝑜𝑜𝑥𝑥 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑅𝑅 𝑅𝑅 = 𝑅𝑅 (4) −1 −1 𝑝𝑝2𝑑𝑑 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑅𝑅 𝑅𝑅 𝑅𝑅 = 𝑅𝑅 𝑅𝑅 (5) −1 𝑝𝑝2𝑑𝑑 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑅𝑅 𝐼𝐼 = 𝑅𝑅 𝑅𝑅 (6) 𝑇𝑇 𝑝𝑝2𝑑𝑑 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 In going from eq. 5 to eq. 6, we used th𝑅𝑅e fact that𝑅𝑅 R-1𝑅𝑅=RT when R is a rotation matrix. Note that the rotation matrix Rp2d rotates the vectors, or (equivalently) the points on the segment. Rp2d is not a rotation of the . The rotation matrices in Winter, 4th ed., chapter 7, are -of-coordinate-systems, which leave the points themselves unmoved. Therefore we calculate Rp2d according to the equation 6. Saying it again, slightly differently, because it is important to understand: Rp2d is the matrix which, if we multiply it times the unit vectors in the proximal segment (as they are at one instant), will give us a set of unit vectors that are identical to the distal segment unit vectors, as they are at that instant. At most joints (the ankle being an exception), we assume the distal and proximal segment unit vectors are aligned in the neutral position. In that case, Rp2d tells us how the distal segment is rotated relative to its neutral orientation.

Rotation-of-Coordinate-System Matrix

An alternate approach to quantifying the relative orientation of segments is to consider rotation of the coordinate reference system, instead of rotation of the distal segment relative to the proximal. Mathematically, there is no particular reason to prefer rotation-of-points or rotation- of-coordinate-systems: either approach will successfully account for rotations in three dimensions. The rotation-of-points approach is, perhaps, easier to visualize, since one rotates the segment itself. However, the rotation-of-coordinate-system approach has a practical advantage for biomechanics: when we do successive rotations of the coordinate system, the second and third rotations will be relative to the rotated (distal segment) axes, because the rotation of coordinates “takes the axes along”. Rotations-of-points do not “take the axes along”, so successive rotations are always about the original axes, and not about the moving distal segment axes.

Imagine rotating the coordinate system along with the distal segment. When we multiply the rotation-of-coordinate-system matrix by a vector, we get the expression of that vector in the rotated reference system. Therefore, the rotation-of-coordinate-system matrix representing the combined movement of the distal segment relative to the proximal will express the unit vectors of the proximal segment (represented by the ) in the distal segment coordinate system. Put another way, the columns of the rotation-of-coordinate-system matrix express what iprox, jprox, and kprox “look like” to an observer in the distal segment coordinate system. We know, from experimental observation of markers, Rprox and Rdistal, whose columns are the unit vectors of the proximal and distal segments, expressed in the GRS. The following equations show how we can use that information to express iprox, jprox, kprox in terms of idistal, jdistal, kdistal.

= + + (7)

𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 11 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 21 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 31 𝒊𝒊 = 𝒊𝒊 𝑞𝑞 + 𝒋𝒋 𝑞𝑞 + 𝒌𝒌 𝑞𝑞 (8)

𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 12 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 22 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 32 𝒋𝒋 = 𝒊𝒊 𝑞𝑞 +𝒋𝒋 𝑞𝑞 +𝒌𝒌 𝑞𝑞 (9)

𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 13 𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 23 𝒅𝒅𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊𝒊 33 The above three equations 𝒌𝒌can be written𝒊𝒊 𝑞𝑞as a matrix𝒋𝒋 equation:𝑞𝑞 𝒌𝒌 𝑞𝑞

( ) = ( ) (10) 𝑞𝑞11 𝑞𝑞12 𝑞𝑞13 21 22 23 𝒊𝒊𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒋𝒋𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒌𝒌𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒊𝒊𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 𝒋𝒋𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 𝒌𝒌𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅𝒅 �𝑞𝑞 𝑞𝑞 𝑞𝑞 � 31 32 33 where iprox, etc., are column vectors. Matrix Q≡(qij) is the rotation-of𝑞𝑞-coordinate𝑞𝑞 𝑞𝑞-system matrix. The columns of Q are the proximal coordinate system unit vectors, expressed in terms of the distal coordinate system. We apply equations 1 and 2 to equation 10:

= (11)

𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑅𝑅 = 𝑅𝑅 𝑄𝑄 (12) −1 −1 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑅𝑅 𝑅𝑅= 𝑅𝑅 𝑅𝑅 𝑄𝑄 (13) 𝑇𝑇 Compare equation 6 to equation 13. Equation𝑄𝑄 𝑅𝑅𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 6 is the𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 rotation-of-points matrix that moves the proximal segment unit vectors into alignment with the distal coordinate system vectors. Q in equation 13 is the rotation-of-coordinate-system matrix, that expresses the proximal segment unit vectors in terms of the distal segment coordinate system.

Summary

We have demonstrated two ways to represent the relative orientation of the distal and proximal segments: by the rotation-of-points (Rp2d) or by the rotation-of-coordinate-systems (Q). We need to estimate the proximal and distal segment unit vectors in the GRF (Rprox and Rdistal) to estimate Rp2d or Q. The next step is to use Rp2d or Q to estimate the joint angles,

Helical Axis and Angles

In the helical approach, we will do a single rotation about an axis which may not be aligned with any of the principle axes in either segment. It is always true that for any non-zero rotation of a segment, there is a single axis n=(nx;ny;nz) and an associated φ such that a rotation by angle φ about n will move the proximal i,j,k into the distal i,j,k. (If the distal segment is in the neutral position relative to the proximal, then the angle φ will be zero and the axis will be undefined.) If n is a unit vector (which we can assume without loss of generality), then the components of n along the X, Y, and Z axes tell us how to “allocate” φ to flexion/extension, abduction/adduction, and internal/external rotation. Now we show how to determine n=(nx;ny;nz) from Rp2d. (Remember that we have already determined Rp2d from marker locations.)

The rotation-of-points matrix arising corresponding to rotation by φ about n=(nx;ny;nz) is

= (1 ) (1 ) (1 ) + 𝑅𝑅ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 (1 2 ) + (1 ) (1 ) (14) 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑢𝑢𝑥𝑥 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑢𝑢𝑥𝑥𝑢𝑢𝑦𝑦 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑢𝑢𝑧𝑧𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑢𝑢𝑥𝑥𝑢𝑢𝑧𝑧 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑢𝑢𝑦𝑦𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 (1 ) (1 2 ) + (1 ) 𝑢𝑢𝑥𝑥𝑢𝑢𝑦𝑦 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑢𝑢𝑧𝑧𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑢𝑢𝑦𝑦 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑢𝑢𝑦𝑦𝑢𝑢𝑧𝑧 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑢𝑢𝑥𝑥𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 � 2 � which𝑢𝑢𝑥𝑥𝑢𝑢𝑧𝑧 can− also𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 be written− 𝑢𝑢𝑦𝑦𝑠𝑠𝑠𝑠 as𝑠𝑠𝑠𝑠 𝑢𝑢𝑦𝑦𝑢𝑢𝑧𝑧 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑢𝑢𝑥𝑥𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 − 𝑢𝑢𝑧𝑧 − 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐

+ 2( + ) 2( ) = 22( 2 2 ) 2 + 2( + ) (15) 𝑒𝑒0 𝑒𝑒1 − 𝑒𝑒2 − 𝑒𝑒3 𝑒𝑒1𝑒𝑒2 𝑒𝑒0𝑒𝑒3 𝑒𝑒1𝑒𝑒3 − 𝑒𝑒0𝑒𝑒2 2( + ) 22( 2 2 ) 2 + ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑐𝑐𝑐𝑐𝑐𝑐 1 2 0 3 0 1 2 3 2 3 0 1 𝑅𝑅 � 𝑒𝑒 𝑒𝑒 − 𝑒𝑒 𝑒𝑒 𝑒𝑒 − 𝑒𝑒 𝑒𝑒 − 𝑒𝑒 2 𝑒𝑒 𝑒𝑒2 𝑒𝑒2 𝑒𝑒 2� (http://mathworld.wolfram.com/EulerParameters.html𝑒𝑒1𝑒𝑒3 𝑒𝑒0𝑒𝑒2 𝑒𝑒2𝑒𝑒3 −, retreived𝑒𝑒0𝑒𝑒1 2013𝑒𝑒0 −-03𝑒𝑒1-22)− 𝑒𝑒 where2 𝑒𝑒3

e0=cos(φ/2) (16a)

e1=nxsin(φ/2), e2=nysin(φ/2), e3=nzsin(φ/2) (16b)

The helical angle approach finds the one single axis n=(nx;ny;nz), about which we can rotate the segment to move it from its neutral to its observed position, and it finds the angle of rotation, φ. We wish to find the unit vector n and the rotation angle φ which will make the theoretical rotation-of-points matrix Rhelical equal to the measured rotation-of-points matrix Rp2d:

= (17)

when 𝑅𝑅ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝑅𝑅𝑝𝑝2𝑑𝑑

= (18) 𝑟𝑟11+𝑟𝑟22+𝑟𝑟33−1 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 2 = (19) 𝑟𝑟11+𝑟𝑟22+𝑟𝑟33−1 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 2 It can be shown by algebra (http://www.kwon3𝜙𝜙 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎d.com/theory/jkinem/helical.html� � , retrieved 2013- 03-24) that each column of the following matrix is a scaled version of the rotation axis, n. = ({ } { } { }) = + + (1 ) (20) 1 𝑇𝑇 1 2 3 ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 where I is the identity𝑁𝑁 𝑛𝑛matrix.𝑛𝑛 Combining𝑛𝑛 equations2 �𝑅𝑅 17, 18,𝑅𝑅 and 20,� we𝐼𝐼 get− 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐

= ({ } { } { }) = + + 1 (21) 1 𝑇𝑇 𝑟𝑟11+𝑟𝑟22+𝑟𝑟33−1 𝑁𝑁 𝑛𝑛1 𝑛𝑛2 𝑛𝑛3 2 �𝑅𝑅𝑝𝑝2𝑑𝑑 𝑅𝑅𝑝𝑝2𝑑𝑑 � 𝐼𝐼 � − 2 � = ({ } { } { }) = + + 1 ( + + ) (22) 1 𝑇𝑇 1 2 3 𝑝𝑝2𝑑𝑑 𝑝𝑝2𝑑𝑑 11 22 33 To minimize𝑁𝑁 round𝑛𝑛-off errors,𝑛𝑛 estimate𝑛𝑛 n2 �by𝑅𝑅 choosing𝑅𝑅 the column𝐼𝐼� − from𝑟𝑟 (22𝑟𝑟) above𝑟𝑟 w��hich has the largest magnitude. Normalize that column vector to have unit length:

= (23) 𝑛𝑛𝑚𝑚𝑚𝑚𝑚𝑚 𝒏𝒏 ‖𝑛𝑛𝑚𝑚𝑚𝑚𝑚𝑚‖ where nmax = column of N with largest magnitude = maxnorm(n1, n2, n3).

Before proceeding further, check that the values for n and φprelim generate a rotation matrix equal

to Rp2d, by plugging n and φprelim into equation 14 and computing Rhelix. If Rhelix does not match

Rp2d to good , set φ=-φprelim. This is necessary because the estimation of φ by equation 19 may result in a sign error for φ. You might think that n would then point the opposite way, in which case we would still get correct answers for angles, but this is not always the case. We do not want small round-off differences between matrices to make us erroneously conclude that the sign of prelim needs changing. Therefore we use equations 14 to compute two rotation-of-points matrices: Rhelix(n,+ prelim) and Rhelixn,- prelim). We choose the sign of that gives a matrix that ϕ is “closer to” the matrix Rp2d , the rotation of points matrix computed with equation 6. We define “closer to” byϕ computing ϕ ϕ

= R , + R (23a)

and 𝑑𝑑+ 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛� ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒�𝑛𝑛 𝜙𝜙𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝� − 𝑝𝑝2𝑑𝑑�

= R , R (23b)

− ℎ𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑝𝑝2𝑑𝑑 where norm denotes the 2-norm,𝑑𝑑 or𝑛𝑛𝑛𝑛𝑛𝑛 equivalently,𝑛𝑛� �𝑛𝑛 the−𝜙𝜙 Euclidean� − norm,� of a matrix. If d- is smaller than d+, we choose = - prelim ; otherwise, we choose = + prelim.

The projections of φn onto theϕ proximalϕ segment axes are the respectiveϕ ϕ amounts of flex/ext, abd/add, and IR/ER. If +X points right (flex/ext axis), +Y points forward (add/abd axis), and +Z points up (IR/ER axis), then

Flexion/extension: = n (24)

Adduction/abduction: 𝜃𝜃𝑋𝑋 = 𝜙𝜙nx (25)

𝜃𝜃𝑌𝑌 𝜙𝜙 y Internal/external rotation: = n (26)

The algorithm just described, for finding the𝜃𝜃 helical𝑍𝑍 𝜙𝜙 axisz and angles, fails when the proximal and distal segments are exactly aligned. It is not surprising that it fails, because when the segments are aligned, the rotation angle should be zero, and in that case there is no uniquely defined axis of rotation. Mathematically, the problem occurs in equation 23: n=nmax/||nmax||. When the proximal and distal segments are aligned, Rp2d is the identity matrix, and when Rp2d=I, the matrix N in equations 20-22 is the zero matrix, and so the vector nmax has length 0, and equation 23 has an undefined (divide by zero) result. This problem is handled by checking for Rp2d=I. If Rp2d=I, the helical angles are set equal to zero, and the axis can be arbitrarily set to n=(1;0;0), or can be estimated by interpolating from nearby time points at which the axis is well defined.

Simulating Movement With Helical Angles

Simulation of movement using helical angles is fairly straightforward. Create a 3xN matrix P, whose columns Pj, j=1..N, are the N points in an object. Choose the axis of rotation n and the desired rotation angle φ. Use equations 15, 16, and 14 to create the rotation-of-points matrix R. Rotation about the origin moves the points P to Protated:

= (27)

𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 where P and Protated are both expressed in𝑃𝑃 the same coordinate𝑅𝑅𝑅𝑅 system, such as the global reference system. Rotation about a point C is achieved as follows, assuming P, C, and Protated are all expressed in the same coordinate system:

= ( … ) + ( … ) (28)

where (C…C) denotes a 3xN 𝑃𝑃matrix𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 composed𝑅𝑅�𝑃𝑃 − of𝐶𝐶 N replicates𝐶𝐶 � 𝐶𝐶 of 𝐶𝐶the column vector C.

Euler Angles

One can decompose a rotation in three dimensions into three successive rotations about axes that are anatomically defined. This is in contrast to the helical approach, in which a single rotation is done about an axis that is not anatomically defined. When using Euler angles, we must define axes and choose the order of rotations. The order of rotation matters. The order dependence can be understood mathematically as a result of the fact the is not commutative: if A and B are matrices, it is generally true that AB≠BA. The order dependence can be understood physically as meaning that, for example, 45° flexion followed by 45° abduction (about the rotated ab/adduction axis) will result in a different segment orientation than 45° abduction followed by 45° flexion (about the rotated flexion/extension axis). The angles of rotation are called Euler angles. We choose to use matrices that represent rotating the coordinate system while leaving the points in place: the rotation-of-coordinate-system matrices. We choose this even though it may be easier to visualize the action of rotation-of-points, which moves the segment itself. To recapitulate the reason, which was also described above: if we do successive rotations of points, each successive rotation is about the original coordinate axes, since points are always expressed in the original coordinate system. This means that the combined rotation matrix RpointsXYZ = RpointsZRpointsYRpointsX, for example, represents rotation about proximal X, then proximal Y, then proximal Z. That’s not what we want. We want to rotate about X (which is the same for proximal and distal segments initially), then about Y’= distal segment Y, then about Z”=twice-rotated distal segment Z. For this reason, we must use rotation-of-coordinate-system matrices.

There are two kinds of rotation sequences that can be used to account for any rotation in three dimensions: Euler sequences and Cardan sequences. Euler sequences use a shared axis in the aligned proximal and distal segments for the first rotation, then an axis in the distal segment, which has been rotated by the first rotation, for the second rotation, and finally, the same distal segment axis that was used for the first rotation is used again for the final rotation – but due to the first two rotations, this axis now points in a different direction than it did initially. An example of such a sequence is X-Y’-X’, or simply X-Y-X. This sequence indicates a rotation about X, followed by a rotation about the rotated Y axis (called Y’ to indicate that it moved during the first rotation), and then about the rotated X axis (denoted X’). There are six possible Euler sequences: X-Y-X, X-Z-X, Y-X-Y, Y-Z-Y, Z-X-Z, Z-Y-Z. Euler sequence rotations can not be accomplished with rotation-of-points. If one attempts to do so, one finds that the first and final rotation axes are the same, and thus there are really only two independent axes of rotation. A rotation sequence with two pre-defined axes is not sufficiently general to account for most rotations in three dimensions.

The second type of rotation sequence is called a Cardan sequence. A Cardan sequence involves rotation about three different axes. The first one is shared between proximal and distal segment, since they are presumed to be aligned initially. The second and third rotations are about the other two orthogonal axes, which are fixed in the distal segment. Because they are fixed in the distal segment, they move with each rotation. An example of a Cardan sequence is X-Y’-Z”, or simply X-Y-Z, denoting an initial rotation about the X axis, then about the rotated Y-axis in the distal segment (denoted Y’), and finally about the twice-rotated Z-axis (Z”) of the distal segment. There are six possible Cardan sequences: X-Y-Z, X-Z-Y, Y-X-Z, Y-Z-X, Z-X-Y, Z-Y-X.

With either kind of sequence, the rotation can be represented by multiplying three rotation matrices.

The matrices that represent rotations of the coordinate system about an axis (rather than rotations of the points themselves) are as follows: 1 0 0 ( ) = 0 (29) 0 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 � 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑥𝑥 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑥𝑥 � −𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃𝑥𝑥 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑥𝑥 = 0 1 0 𝑦𝑦 𝑦𝑦 (30) 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 0 −𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦� � � 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑦𝑦 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑦𝑦0 ( ) = 0 (31) 𝑧𝑧 𝑧𝑧 𝑐𝑐𝑐𝑐𝑐𝑐0𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃 1 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 �−𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑧𝑧 𝑐𝑐𝑐𝑐𝑠𝑠𝜃𝜃𝑧𝑧 � The rotation matrices above operate on points represented as column vectors, and therefore the rotation matrix is to the left of the column vector, or the matrix of points. When several rotations are done, the matrix for the first rotation is right-most and the last rotation is left-most. This allows the first (right-most) matrix to operate first on the point or points. For example, expression of point = in a coordinate system that is rotated about X, then Y’, then Z’’ is 𝑝𝑝𝑥𝑥 0 𝑦𝑦 represented with matrices𝑃𝑃 � as𝑝𝑝 follows:� 𝑝𝑝𝑧𝑧 = ( ) ( ) = ( ) = ( ) (32)

𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑍𝑍 𝑧𝑧 𝑌𝑌 𝑦𝑦 𝑋𝑋 𝑥𝑥 0 𝑍𝑍 𝑧𝑧 𝑌𝑌 𝑦𝑦 1 𝑍𝑍 𝑧𝑧 2 𝑃𝑃 𝑅𝑅 𝜃𝜃 𝑅𝑅 �𝜃𝜃 �𝑅𝑅 𝜃𝜃 =𝑃𝑃 𝑅𝑅 𝜃𝜃 𝑅𝑅 �𝜃𝜃 �𝑃𝑃 𝑅𝑅 𝜃𝜃 𝑃𝑃 (33)

𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 0 where Rtotal is the rotation-of-coordinate𝑃𝑃-system matrix,𝑅𝑅 𝑃𝑃 and P0 and Pfinal are the same vector, expressed in the initial (proximal) and final (distal) coordinate systems respectively. Rtotal depends on the rotation sequence chosen, as shown in the following table.

Cardan Sequences Rtotal = X then Y’ then Z” = ( ) ( ) Y then X’ then Z” = ( ) ( ) 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 X then Z’ then Y” = ( ) ( ) 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦� Z then X’ then Y” = ( ) ( ) 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 Y then Z’ then X” = ( ) ( ) 𝑅𝑅𝑍𝑍𝑍𝑍𝑍𝑍 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 Z then Y’ then X” = ( ) ( ) 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦� Euler Sequences 𝑅𝑅𝑍𝑍𝑍𝑍𝑍𝑍 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 X then Y’ then X” = ( ) ( ) Y then X’ then Y” = ( ) 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥2 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥1 X then Z’ then X” = ( ) ( ) ( ) 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦2�𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦1� Z then X’ then Z” = ( ) ( ) ( ) 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥2 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥1 Y then Z’ then Y” = ( ) 𝑅𝑅𝑍𝑍𝑍𝑍𝑍𝑍 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧2 𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧1 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦2�𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦1� Z then Y’ then Z” = ( ) ( )

Table 1. Rotation-of-coordinate𝑍𝑍𝑍𝑍𝑍𝑍-system𝑍𝑍 matrices𝑧𝑧2 𝑌𝑌 𝑦𝑦for a𝑍𝑍ll Cardan𝑧𝑧1 and Euler sequences. 𝑅𝑅 𝑅𝑅 𝜃𝜃 𝑅𝑅 �𝜃𝜃 �𝑅𝑅 𝜃𝜃

If P0 and Pfinal are direction vectors, as is the case when we are estimating joint angles from segment unit vectors, then it does not matter if the two systems share an origin or not, since direction vectors are independent of origin. If P0 and Pfinal are position vectors, then the origin matters, and equation 33 will be correct if and only if the proximal and distal systems share an origin.

We will now complete the explanation of how to use Rtotal and the matrix Q, which we obtain from motion capture data, to estimate Euler angles. We use the rotation-of-coordinate-system matrices (equations 29-31) for RX, RY, and RZ to compute the theoretical Rtotal for our preferred rotation sequence. Then we assign values to the angles that will make the theoretical matrix Rtotal equal to the experimentally measured matrix Q.

Euler example 1

If we choose to rotate about X, then Y’, then Z”, then we see from Table 1 that

= = ( ) ( ) (34)

which after plugging in from𝑅𝑅 equations𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑅𝑅 𝑋𝑋29𝑋𝑋𝑋𝑋-31 becomes𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅 𝑌𝑌�𝜃𝜃𝑦𝑦�𝑅𝑅𝑋𝑋 𝜃𝜃𝑥𝑥

0 0 1 0 0 = 0 0 1 0 0 (35) 𝑍𝑍 𝑍𝑍 𝑌𝑌 𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐0𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃 1 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 0 −𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 0 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 �−𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑍𝑍 � � � � 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 � 0 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌 −𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 = 0 0 (36) 𝑍𝑍 𝑍𝑍 𝑌𝑌 𝑋𝑋 𝑌𝑌 𝑋𝑋 𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐0𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃 1 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 −𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 �−𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑍𝑍 � � 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 � +𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌 −𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐+𝜃𝜃𝑌𝑌 = + + (37) 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 −𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑋𝑋𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 �−𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 −𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 � 𝑌𝑌 𝑋𝑋 𝑌𝑌 𝑋𝑋 𝑌𝑌 Choose the angles𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 θX,θY,θZ to make R−𝑠𝑠XYZ𝑖𝑖𝑖𝑖𝑖𝑖 equal𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 the measured Q, from equation𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 𝑐𝑐𝑐𝑐𝑐𝑐 13:𝜃𝜃

= = 11 12 13 (38) −1 𝑞𝑞 𝑞𝑞 𝑞𝑞 21 22 23 𝑄𝑄 𝑅𝑅𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 �𝑞𝑞 𝑞𝑞 𝑞𝑞 � 31 32 33 RXYZ equals Q when 𝑞𝑞 𝑞𝑞 𝑞𝑞

= 2( , ) (39)

𝜃𝜃𝑍𝑍 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 −𝑞𝑞21 𝑞𝑞11 = 2( , ) (40)

𝑋𝑋 32 33 =𝜃𝜃 𝑎𝑎𝑎𝑎𝑎𝑎2(𝑎𝑎 ,−+𝑞𝑞 𝑞𝑞+ ) (41) 2 2 𝑌𝑌 31 11 21 where atan2(y,x) = four quadrant𝜃𝜃 arctangent𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 function.𝑞𝑞 � 𝑞𝑞 With 𝑞𝑞the above definitions, θX and θZ will be in the range [-π,+π], and θY will be in the range [-π/2,+π/2].

Euler example 2

If we reverse the order of the first and second rotations, we will rotate about Y, then X’, then Z”. Using the same approach as before, we now obtain

= = ( ) ( ) (42)

which after plugging in from𝑅𝑅 equations𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑅𝑅 𝑌𝑌29𝑌𝑌𝑌𝑌-31 becomes𝑅𝑅𝑍𝑍 𝜃𝜃𝑧𝑧 𝑅𝑅 𝑋𝑋 𝜃𝜃𝑥𝑥 𝑅𝑅𝑌𝑌�𝜃𝜃𝑦𝑦�

0 1 0 0 0 = 0 0 0 1 0 (43) 𝑍𝑍 𝑍𝑍 𝑌𝑌 𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐0𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃 1 0 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 0 −𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 �−𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑍𝑍 � � 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 � � � 0 −𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 0 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌 = 0 (44) 𝑍𝑍 𝑍𝑍 𝑌𝑌 𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐0𝜃𝜃 𝑠𝑠𝑠𝑠𝑠𝑠0𝜃𝜃 1 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 −𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 �−𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑍𝑍 � �𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌 � + 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌 −𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋 𝑐𝑐𝑐𝑐𝑐𝑐+𝜃𝜃𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌 = + + (45) 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑍𝑍 −𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑅𝑅𝑌𝑌𝑌𝑌𝑌𝑌 �−𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑌𝑌𝑠𝑠𝑠𝑠𝑠𝑠𝜃𝜃𝑍𝑍 𝑠𝑠𝑖𝑖𝑖𝑖𝑖𝑖𝑋𝑋𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑌𝑌𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃𝑍𝑍 � 𝑋𝑋 𝑌𝑌 𝑋𝑋 𝑋𝑋 𝑌𝑌 Choose the angles θX,θ𝑐𝑐𝑐𝑐𝑐𝑐Y,θ𝜃𝜃Z to𝑠𝑠𝑠𝑠 make𝑠𝑠𝜃𝜃 RYXZ equal the−𝑠𝑠 𝑖𝑖measured𝑖𝑖𝑖𝑖 Q, from equation𝑐𝑐𝑐𝑐𝑐𝑐𝜃𝜃 𝑐𝑐𝑐𝑐𝑐𝑐 13:𝜃𝜃

= = 11 12 13 (46, same as 38) −1 𝑞𝑞 𝑞𝑞 𝑞𝑞 21 22 23 𝑄𝑄 𝑅𝑅𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 �𝑞𝑞 𝑞𝑞 𝑞𝑞 � 31 32 33 RYXZ equals Q when 𝑞𝑞 𝑞𝑞 𝑞𝑞

= 2( , ) (47)

𝜃𝜃𝑍𝑍 = 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎2(𝑞𝑞12, 𝑞𝑞22) (48)

𝑌𝑌 31 33 = 𝜃𝜃 2𝑎𝑎𝑎𝑎𝑎𝑎( 𝑎𝑎 ,𝑞𝑞+ 𝑞𝑞 + ) (49) 2 2 𝑋𝑋 32 31 33 where atan2(y,x) = four quadrant𝜃𝜃 arctangent𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 function.−𝑞𝑞 � With𝑞𝑞 the𝑞𝑞 above definitions, θY and θZ will be in the range [-π,+π], and θX will be in the range [-π/2,+π/2]. Simulating Movement With Euler Angles

The simulation of movement using successive rotations about axes that move with the segment is not as simple as simulation with helical angles. We cannot use rotation-of-points matrices, because they rotate about axes that remain fixed in the proximal (not-rotating) segment. If Rpoints is the rotation-of-points matrix, and Rtotal is the rotation-of-coordinate-system matrix from Table 1, then it follows from equation 32b that

= = , (50)

𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 0 0 because if we first rotate the point𝑃𝑃 P0 with𝑅𝑅 Rpoints�,𝑅𝑅 then rotate𝑃𝑃 � the𝑃𝑃 coordinate system by an equal amount with Rtotal, the final point Pfinal, which is expressed in the rotated coordinate system, will have to equal the original point P0, which is expressed in the unrotated system. Equation 32b is true if and only if

= = , (51) −1 𝑇𝑇 where we note that for rotation matrices,𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 the𝑅𝑅 inverse𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 equals𝑅𝑅𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 the transpose. If the rotation is done about a point C other than the origin, and C is expressed in the proximal coordinate system, then the rotated point Protated, expressed in the proximal coordinate system, is given by

= ( ) + . (52) 𝑇𝑇 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 𝑡𝑡𝑜𝑜𝑜𝑜𝑜𝑜𝑜𝑜 0 We can rotate N points in a segment𝑃𝑃 at once𝑅𝑅 by making𝑃𝑃 − a 𝐶𝐶3xN matrix𝐶𝐶 P, whose columns Pj are the N points. Then

= ( … ) + ( … ) (53) 𝑇𝑇 𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟 𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡𝑡 where P and Protated are now𝑃𝑃 3xN matri𝑅𝑅ces whose�𝑃𝑃 − columns𝐶𝐶 𝐶𝐶 �are points𝐶𝐶 𝐶𝐶 expressed in the proximal coordinate system, and (C…C) is a 3xN matrix formed by N replicates of the column vector for point C. To simulate rotation by an Euler sequence, specify the desired angles and rotation sequence. Then evaluate Rtotal using Table 1 and equations 29-31. Then use equation 53 to compute the coordinates of the rotated points in the proximal coordinate system.

Shoulder Joint

Shoulder joint recommendations of the International Shoulder Group (ISG) were published by Wu et al., J Biomech 38 (2005) 981–992. The recommendations include description of a “thoracohumeral joint”. A more anatomically correct description involves the thoracoclavicular, claviculoscapular, and scapulohumeral joints. It is difficult to track the 3D motions of clavicle and scapula with skin markers, due to movement artifacts. For this reason, the thoracohumeral joint is often used to describe shoulder motion. The markers and axis definitions for the thorax and humerus are shown below. GH is the glenohumeral joint center, determined by regression or spherical fitting.

Figure 2 of Wu et al., 2005, below, shows the thorax coordinate system.

Yt: The connecting the midpoint between PX and T8 and the midpoint between IJ and C7, pointing upward. Zt: The line perpendicular to the formed by IJ, C7, and the midpoint between PX and T8, pointing to the right. Xt: The common line perpendicular to the Zt-and Yt-axis, pointing forwards.

Figure 5 of Wu et al., 2005, below, shows the humerus coordinate system, recommendation 1.

Yh1: The line connecting GH and the midpoint of EL and EM, pointing to GH. Xh1: The line perpendicular to the plane formed byEL, EM, and GH, pointing forward. Zh1: The common line perpendicular to theYh1- and Zh1-axis, pointing to the right. Wu et al., 2005, also give a second humerus coordinate recommendation, in which the long axis of the flexed forearm is used to define the Xh axis, rather than using the EL and EM markers. The disadvantage of recommendation 1 is that it uses EL and EM to define Zh. Since EL and EM are close together, small marker placement variation or skin movement can make large angle differences. The disadvantage of the recommendation 2 is that it requires tracking the forearm, and it doesn’t work if the elbow is extended.

Figure 7 of Wu et al., 2005, below, shows the ISG recommendation for decomposing thoracohumeral motion into three rotations: Yh-Xh-Yh.

The first rotation is about Yh. This is referred to in Figure 7 as “Plane of elevation” because this rotates the plane in which the humerus will be elevated in the middle rotation. The middle rotation is about Xh, and is elevation. Note that Xh points anteriorly in the neutral or initial position. Therefore, if the first rotation is zero, the rotation about Xh is abduction/adduction. (It is called negative elevation because elevating the right humerus is a negative rotation about Xh.) The final rotation is about Yh again: a final axial (internal/external) rotation. Wu et al., 2005, chose the Yh-Xh-Yh sequence because it is well known that if one allows both flex/ext (i.e rotation about Zh) and abd/add (rotation about Xh), the angles obtained are different depending on the sequence chosen. The solution of Wu et al. is to do only one “elevation”, and so avoid the issue of how much is abd/add and how much is flex/ext. A sagittal plane motion of the humerus, which is traditionally and clinically regarded as flexion/extension, is described by the ISG recommendation as 90° internal rotation, then elevation, then 90° external rotation.

The rotation matrix representation of the ISG recommended sequence is

= ( ) ( ) ( ) (54)

𝐼𝐼𝐼𝐼𝐼𝐼 𝑌𝑌 2 𝑋𝑋 𝑌𝑌 1 where θ1 is the initial rotation about𝑅𝑅 the humerus𝑅𝑅 𝜃𝜃 𝑅𝑅long𝜙𝜙 axis𝑅𝑅 (“rotation𝜃𝜃 of the plane of elevation”), φ is the elevation, and θ2 is the final rotation about the humerus long axis (internal/external rotation). Note that this is an Euler sequence, since the first and final rotation axes are the same, in the distal segment.

An alternative to the ISG recommendation is to do a Cardan sequence. We will now introduce an alternative set of axis definitions used by some investigators including James Richards. In this set of axis definitions, +X points to the subject’s right, +Y points forward, and +Z points upward. Using the Richards et al. axes, positive rotation about X is shoulder flexion, positive about Y is right humerus ADduction, and positive about Z is right humerus internal rotation.

If the final rotation is IR/ER, and if we use the axis definitions of Richards et al., then there are two Cardan sequences to choose from Xh-Yh-Zh or Yh-Xh-Zh. The Xh-Yh-Zh sequence correspond to flex/ext, then add/abd, then IR/ER (positive/negative in each case, for the right shoulder). Its matrix representation is

= ( ) ( ) ( ) (55)

The Yh-Xh-Zh sequence correspond𝑅𝑅𝑋𝑋𝑋𝑋𝑋𝑋 to add/abd𝑅𝑅𝑍𝑍 𝜃𝜃𝑍𝑍, then𝑅𝑅𝑌𝑌 𝜃𝜃 flex/ext,𝑌𝑌 𝑅𝑅𝑋𝑋 𝜃𝜃𝑋𝑋 then IR/ER. Its matrix representation is

= ( ) ( ) ( ) (56)

𝑌𝑌𝑌𝑌𝑌𝑌 𝑍𝑍 𝑍𝑍 𝑋𝑋 𝑋𝑋 𝑌𝑌 𝑌𝑌 where ±θX=flexion/extension, ±θY𝑅𝑅=adduction/abduction,𝑅𝑅 𝜃𝜃 𝑅𝑅 𝜃𝜃 𝑅𝑅 and𝜃𝜃 ±θZ=internal/external rotation. We showed above (equations 37-41) that RXYZ equals Q when

= 2( , ) (39, again)

𝜃𝜃𝑍𝑍 𝑎𝑎𝑎𝑎𝑎𝑎𝑎𝑎 −𝑞𝑞21 𝑞𝑞11 = 2( , ) (40, again)

𝑋𝑋 32 33 =𝜃𝜃 𝑎𝑎𝑎𝑎𝑎𝑎2(𝑎𝑎 ,−+𝑞𝑞 𝑞𝑞+ ) (41, again) 2 2 where atan2(y,x) = four quadrant𝜃𝜃 arctan𝑌𝑌 𝑎𝑎𝑎𝑎𝑎𝑎gent𝑎𝑎 function𝑞𝑞31 �. 𝑞𝑞11 𝑞𝑞21

Hip Joint

We can use a similar approach at the hip as at the shoulder. With the pelvis and femur in the neutral position, Xpelvis and Xfemur point to the subject’s right, Ypelvis and Yfemur point forward, and Zpelvis and Zfemur point upward. We can decompose hip motion with a sequence of flexion/extension followed by adduction/abduction followed by internal/external rotation. This means we rotate coordinates about Xpelvis=Xfemur, then about rotated Yfemur, then about twice- rotated Zfemur. The rotation matrix representation of this sequence is

= ( ) ( ) ( ) (55, again)

𝑋𝑋𝑋𝑋𝑋𝑋 𝑍𝑍 𝑍𝑍 𝑌𝑌 𝑌𝑌 𝑋𝑋 𝑋𝑋 where ±θX=flexion/extension, ±θY𝑅𝑅=adduction/abduction,𝑅𝑅 𝜃𝜃 𝑅𝑅 𝜃𝜃 𝑅𝑅 and𝜃𝜃 ±θZ=internal/external rotation, for the right hip joint. For the left hip joint, ±θX=flexion/extension, ±θY=ABduction/ADduction, and ±θZ=EXternal/INternal rotation. Unit vectors for pelvis and thigh segments are identified from markers. The unit vectors, expressed as column vectors in the GRS, form the matrices

= = ( ) (57)

𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒊𝒊𝒔𝒔 𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑𝒑 𝑅𝑅 = 𝑅𝑅 = (𝒊𝒊 𝒋𝒋 𝒌𝒌 ). (58)

𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇 𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇 𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇𝒇 Q is defined as in equation𝑅𝑅𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑𝑑 38: 𝑅𝑅𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝒊𝒊 𝒋𝒋 𝒌𝒌

= = 11 12 13 (38, again) −1 𝑞𝑞 𝑞𝑞 𝑞𝑞 21 22 23 𝑄𝑄 𝑅𝑅𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓𝑓 𝑅𝑅𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 �𝑞𝑞 𝑞𝑞 𝑞𝑞 � 31 32 33 and angles θX, θY, θZ (flex/ext, ad/ab, IR/ER respectively)𝑞𝑞 are𝑞𝑞 determined𝑞𝑞 using equations 39-41.

Grood and Suntay and Knee Joint

Grood & Suntay (1983), J Biomech Engin 105: 136-144, proposed a “joint coordinate system” for the knee joint which has been widely cited. They proposed a standard rotation sequence and gave formulas for the rotation matrix in terms of “clinical angles”. They also gave equations for changing from tibial to femoral coordinate system when there is as well as rotation at the knee joint. They think about knee joint angles as arising from rotation about an axis fixed in the proximal segment, followed by rotation about a floating axis, followed by rotation about an axis fixed in the distal segment. The floating axis is perpendicular to the two body-fixed axes. They say that their approach gives a sequence-independent description of knee joint. I do not think their proposed scheme was as new as they thought it was. I also think it is not sequence-independent, and their proposal does not “eliminate much of the confusion relative to nomenclature”, as they think. They use a specific sequence of rotations. Their equations for rotation matrix elements in their Appendix would be different if they had used a different sequence, which indicates that their claim of sequence-independence is not true. Their coordinate axes for thigh and shank are +X=right, +Y=anterior, and +Z=superior. They propose to rotate about X, then Y, then Z. This means flexion/extension, then AB/ADduction, then internal/external rotation. What they call the “floating axis” is really just the once-rotated Y axis, the axis of AB/ADduction. They call it “floating” because it is not aligned with any of the principle axes at the start or at the end. But that is standard for the axis of the middle rotation of a Cardan sequence. It is also worth noting that the “clinical angles” β and γ of Grood & Suntay 1983 are not defined positively by the RH rule in the right knee, as is usually the case.

Matlab files rot_coordsXYZ.m return points in rotated coordinate system rot_coordsXYZmtx.m return rotation-of-coordinate-system matrix rot_helixmtx.m return rotation-of-points matrix for any helical rotation rot_pointsXYZ.m return rotated points (rotations not in moving segment axes) shouldersim1.m simulation code using rot_pointsXYZ.m shouldersim2.m simulation code using rot_coordsXYZmtx.m shouldersimdata1.txt simulated data made with shouldersim1.m shouldersimdata2.txt simulated data made with shouldersim2.m euleranglesXYZ.m compute Euler angles for X-Y’-Z”, from Rprox, Rdist euleranglesYXZ.m compute Euler angles for Y-X’-Z”, from Rprox, Rdist helicalangles.m compute helical angles from Rprox, Rdist shoulder_angle_estimation.m estimate Euler and helical angles from shoulder marker data