Appendix—Mathematics

Appendix—Mathematics

Appendix A Appendix—Mathematics A.1 Mathematical Basics A.1.1 Scalar Product The “scalar product” of two vectors a and b is defined as ⎛ ⎞ ⎛ ⎞ ax bx ⎝ ⎠ ⎝ ⎠ ay · by = ax bx + ayby + azbz =|a|·|b|·cos(θ). (A.1) az bz The geometric interpretation of the scalar product is the projection of one vector onto another (Fig. A.1,left). A.1.2 Cross Product The “cross product” or “vector product” of two vectors a and b is defined as ⎛ ⎞ ⎛ ⎞ ⎛ ⎞ ax bx aybz − azby ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ay × by = azbx − ax bz . (A.2) az bz ax by − aybx The resulting vector is perpendicular to a and b, and vanishes if a and b are parallel. The length of the vector is given by the area of the parallelogram spanned by the two vectors (Fig. A.1, right). © Springer International Publishing AG, part of Springer Nature 2018 115 T. Haslwanter, 3D Kinematics, https://doi.org/10.1007/978-3-319-75277-8 116 Appendix A: Appendix—Mathematics Fig. A.1 Graphical interpretation of scalar product (left) and vector product (right). Note that |a|=a,andthesameforb It may be worth noting that the “invention” of the scalar and vector product goes back to quaternions: for two pure quaternions, the quaternion product separates neatly into the dot product for the scalar part, and the cross product for the vector part: with u˜ = (0, u) and v˜ = (0, v),Eq.(4.6) turns to u˜ ◦ v˜ = (u · v) ∗ 1 + (u × v) · I . (A.3) A.1.3 Matrix Multiplication In general, the multiplication of two matrices A and B is defined as A · B = C (A.4) with Cik = AijB jk. j This equation can also be used for multiplication of a matrix with a column vector, when the vector is viewed as a matrix with n rows and one column. Example 1 (Rotation of a Point in Space) If p is a column vector indicating the position of a point in space, the location of the point rotated by the rotation matrix R is given by p = R · p . (A.5) Example 2 (Rotation of a Rotation Matrix) If Rrot describes a rotation about a space- fixed axis, a transformation of this rotation by the matrix Rtrans is given by = · · −1 . Rrot Rtrans Rrot Rtrans (A.6) For example, if Rrot describes a positive rotation about the x-axis, and Rtrans a ◦ rotation about the z-axis by 90 , then the result of Eq. (A.6), Rrot, describes a positive Appendix A: Appendix—Mathematics 117 rotation about the y-axis. A simple computational proof can be implemented with Python: # import the required packages import numpy as np import skinematics as skin # Define a rotation about the x-axis by "alpha" ... Rs_rot = skin.rotmat.R_s(’x’,’alpha’) # ... and one about the z-axis by "theta" Rs_trans = skin.rotmat.R_s(’z’, ’theta’) # Now "rotate the rotation", find the result for "theta"=90deg=pi/2, and show the result Rs_rot_transformed = ( Rs_trans * Rs_rot * Rs_trans.inv() ).subs(’theta’, np.pi/2) Rs_rot_transformed # Output: #Matrix( # [1.0*cos(alpha), -6.1e-17*cos(alpha) + 6.1e-17, 1.0*sin(alpha)], # [-6.1e-17*cos(alpha), 3.7e-33*cos(alpha) + 1.0, -6.1e-17*sin(alpha)], # [-1.0*sin(alpha), 6.1e-17*sin(alpha), cos(alpha)]] ) Ignoring numerical artifacts, which show up as values multiplied with factors < exp(−15), comparison of the output with Eq. (3.15) shows that the result is a rotation matrix for a positive rotation about the y-axis by α. A.1.4 Basic Trigonometry The basic elements of trigonometry are illustrated in Fig. A.2. For small angles (i.e., θ << 1 ) a Taylor series expansion of the sine, cosine, and tangent functions gives sin(θ) ≈ tan(θ) ≈ θ , and (A.7) θ2 cos(θ) ≈ 1 − . (A.8) 2 Thus for small angles, the change in the cosine is only a second-order effect. 118 Appendix A: Appendix—Mathematics Fig. A.2 Basic trigonometry A.2 Alternative Gram–Schmidt Calculation The Gram–Schmidt algorithm can be used to calculate a right-handed orthogonal coordinate system, based on the location of three points pi in space. One possible implementation has been given in Sect.6.1.2. Another implementation is shown below: − = p1 p0 , ax |p −p | (1 ) 0 = p02 ⊥ax , ( ) = ( − ) − ( · ( − )) ∗ , ay ( ) with p02 ⊥ax p2 p0 ax p2 p0 ax and (A.9) | p02 ⊥ax | az = ax × ay . The second formula in Eq. (A.9) is obtained by looking at the decomposition of a vector b into one component parallel to a, and one component perpendicular to a: b = b + b⊥ (see Fig. A.3), and utilizing the fact that |a| = 1 b = a ∗ |b| ∗ cos(α) = a ∗ (b · a) (A.10) b⊥ = b − b . Fig. A.3 Decomposition of a vector b into two components: one parallel to a (b), and one per- pendicular to a (b⊥) Appendix A: Appendix—Mathematics 119 The three resulting orthogonal unit vectors ai(t) define the rotation matrix R which describes the orientation of an object in 3-D space: R(t) = ax(t) ay(t) az(t) . (A.11) A.3 Proofs of Selected Equations A.3.1 Quaternion Multiplication 3 3 Proof of Eq. (4.6) requires the calculation of qi Ii ∗ p j I j , using the commu- i=0 j=0 tation relationships specified in Eq. (4.5): 3 3 p˜ ◦ q˜ = pi Ii ∗ q j I j = = i 0 j 0 ˜ ˜ ˜ ˜ ˜ ˜ = q0 ∗ 1 + q1 ∗ i + q2 ∗ j + q3 ∗ k) ∗ (p0 ∗ 1 + p1 ∗ i + p2 ∗ j + p3 ∗ k ˜ ˜ ˜ ˜ ˜ ˜ = q0 p0 ∗ 1 ∗ 1 + q1 p1 ∗ i ∗ i + q2 p2 ∗ j ∗ j + q3 p3 ∗ k ∗ k + (q0 ∗ 1 ∗ p · I + p0 ∗ 1 ∗ q · I) ˜ ˜ ˜ ˜ + (q1 p2 ∗ i ∗ j + q2 p1 ∗ j ∗ i ˜ ˜ ˜ ˜ + q2 p3 ∗ j ∗ k + q3 p2 ∗ k ∗ j ˜ ˜ ˜ ˜ + q1 p3 ∗ i ∗ k + q3 p1 ∗ k ∗ i) = (q0 p0 − q · p ) ∗ 1 + ( q0 p + p0 q + q × p ) · I . (A.12) Note that in Eq. (A.12) p˜ indicates a quaternion, and p the corresponding quater- nion vector. The same style convention is also used for the pair (q˜/q). A.3.2 Quaternions and Rotation Matrices Hypothesis The relationship between quaternions and rotation matrices is given by Eq. (4.14), − 0 x˜ = q˜ ◦ x˜ ◦ q˜ 1 = . (A.13) R · x where q˜ is a unit quaternions Proof For this proof, the following basic trigonometric relationships will be needed: sin2(α) + cos2(α) = 1 , (A.14) 120 Appendix A: Appendix—Mathematics sin(2α) = 2 ∗ sin(α) ∗ cos(α), (A.15) cos(2α) = cos2(α) − sin2(α) , and (A.16) a × b × c = b ∗ (a · c) − c ∗ (a · b) . (A.17) Equations (A.14) and (A.16) also imply α α α α α 1 − cos(α) = sin2( ) + cos2( ) − cos2( ) − sin2( ) = 2 ∗ sin2( ). 2 2 2 2 2 (A.18) The first part of Eq. (A.13)is q 0 q˜ ◦ x˜ = 0 ◦ = (−q · x) + (q ∗ x + q × x) · I . (A.19) q x 0 Inserting this into Eq. (A.13) leads to − −q · x q q˜ ◦ x˜ ◦ q˜ 1 = ◦ 0 . (A.20) q0 ∗ x + q × x −q The scalar part of Eq. (A.20)is − q0 ∗ q · x + q0 ∗ q · x + (q × x) · q = 0 . (A.21) And the vector part of Eq. (A.20)is (q · x) ∗ q + q2 ∗ x + q ∗ q × x − q ∗ x × q − (q × x × q) = 0 0 0 ( · ) ∗ + 2 ∗ + ∗ × − ∗ 2 − ∗ ( · ) . q x q q0 x 2q0 q x x q q q x (A.22) = ( θ ) = ∗ ( θ ) Since q0 cos 2 and q n sin 2 , and using Eq. (A.18), Eq. (A.22) can be written as θ θ θ θ θ 2 ∗ sin2( ) ∗ n ∗ (n · x) + x ∗ cos2( ) − sin2( ) + 2 ∗ sin( ) ∗ cos( ) ∗ n × x 2 2 2 2 2 = (1 − cos(θ)) ∗ n(n · x) + x cos(θ) + sin(θ) ∗ n × x . (A.23) Since the right side of Eq. (A.23) equals the Rodrigues representation of a rotation [(Eq. (4.2)], and since the scalar part of the equation is zero [(Eq. (A.21)], this completes the proof of Eq. (A.13). Appendix A: Appendix—Mathematics 121 A.3.3 Space-Fixed Versus Body-Fixed Rotations In a space-fixed, orthogonal coordinate system, the components of a space-fixed point psf are given by the projection of the point onto the coordinate axes. Assuming that vectors are by default column vectors ⎛ ⎞ px ⎝ ⎠ p = py (A.24) pz sf then i th component of the vector can be obtained by T psf,i = p · ei . (A.25) Hypothesis The orientation of the basis vectors of a rotated coordinate system is given by the columns of R. But the vector components of a space-fixed point p transform with RT into the rotated coordinate system. Proof Rotation matrices are elements of the special orthogonal group SO3, which means that RT = R−1. (A.26) And since (A · B)T = BT · AT (A.27) = · the coordinates of a space-fixed point p, in a rotated coordinate system ei R ei, are given by = T · pbf,i p ei T = p · R · ei (A.28) T T = (R · p) · ei . In summary = · , ei R ei (A.29) but ⎛ ⎞ ⎛ ⎞ px px ⎝ ⎠ = T · ⎝ ⎠ . py R py (A.30) p pz bf z sf 122 Appendix A: Appendix—Mathematics Or expressed in words: the coordinates (Eq. A.30) transform with the inverse of the transformation of the basis vectors (Eqs. 3.3 and A.29). A.4 Clifford Algebra The focus of this book has been to enable the user to work with recordings of position and orientation in three dimensions.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    71 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us