Rotation Matrices 3
Total Page:16
File Type:pdf, Size:1020Kb
Rotation Matrices 3 William C. Rose 20131121, 20150928 Outline Markers and Measured Orientation Vectors Helical Axis and Angles Rotation about Fixed Axes 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 unit vector 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, and also to use this information to simulate motion. 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 rotation matrix that moves an object (a set of points) is Rp2d : = (3) 2 = (4) −1 −1 2 = (5) −1 2 = (6) −1 2 The rotation matrix Rp2d rotates the vectors, or (equivalently) the points on the segment. When doing simulation, we can think of Rp2d as the rotation needed to move the object from its initial position to its current position. Rp2d is not a rotation of the coordinate system. The rotation matrices in Winter, 4th ed., chapter 7, are rotations-of-coordinate-systems, which leave the points themselves unmoved. 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 laboratory or segment principle axes. For any non-zero rotation of a segment, there is a single axis n=(nx;ny;nz) and an associated angle φ such that a rotation by angle φ about n will move the proximal, or initial, i,j,k into the distal, or final, 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. Two obvious questions come to mind: Question 1. If n and φ are given, what is Rp2d? Question 2. If Rp2d is known, find n and φ. Answer to question 1: 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 12 03 13 − 02 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.html13 02 23 −, retreived01 20130 −-031-22)− where2 3 e0=cos(φ/2) (16a) e1=nxsin(φ/2), e2=nysin(φ/2), e3=nzsin(φ/2) (16b) Answer to question 2: We set = equal to Rhelical, where Rhelical is given by equation 14, above. 11 12 13 2 21 22 23 Setting individual� matrix elements � equal, it follows that 31 32 33 2 sin = 2 sin = 2 sin (17) 32 − 23 13 31 2 sin � − � � � � � 21 12 From which it follows that − = (18) 32 − 23 32 − 23 13 31 13 31 � � � − ���� − �� and 21 − 12 21 − 12 = sin ( ) + ( ) + ( ) 2 (19) −1 2 2 2 32 23 13 31 21 12 Equations 18 and 19 are the answer�� to− question 2: If −Rp2d is known, − what are⁄ the� helical axis n and helical angle φ? Equations 18 and 19 fail if the rotation matrix is diagonal, because (18) becomes undefined (zero divided by zero). There are four possible diagonal rotation matrices (since we are excluding reflections, as they cannot occur in joints): the identity matrix (i.e. no rotation) and the 180° rotations about x, y, and z. A helical angle software routine should recognize and handle these special cases. Rotation about Fixed Axes The matrices that represent 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. Rotation about X, then Y, then Z is represented with matrices as follows: = ( ) ( ) = ( ) = ( ) (32) 0 1 2 � � = , � � (33) 0 where Rp,total is the rotation-of-points matrix, and P0 and Pfinal are the initial and final positions of the point. Rp,total depends on the rotation sequence chosen. This approach is not helpful for analyzing joint rotations, because all the rotations about about the original fixed axes. To represent, for example, flexion, then abduction of the flexed segment, then internal rotation of the flexed, abducted segment, or a similar sequence, the latter rotations must be about the “rotated” axes. This is done by using rotation-of-coordinate transformations. 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 .