3D Kinematics Consists of two parts 2D (rigid body) kinematics C.M. translation and rotation 3D Kinematics Consists of two parts 3D rotation 3D translation The same as 2D 3D rotation is more complicated than 2D rotation (restricted to z-axis) Spring 2016
Homogeneous Coordinates (齊次座標) Translate, rotate with matrices Homogeneous Coordinates (齊次座標) Fall 2016
Homogeneous Coordinate Point in 3D: Translate(a,b,c) with homo. coord.: Fall 2016
Rotate a Point about Origin Rotate (z, q) r z Polar Coordinate: P (x, y) = (r cosf, r sinf) Fall 2016
Rotation Matrices v = Hu Fall 2016
Order Matters?! Translate(t1) Translate (t2) = Translate (t2) Translate (t1) Translate(t) Rotate(R) ≠ Rotate (R) Translate (t) Rotate (R1) Rotate (R2) ≠ Rotate (R2) Rotate (R1) Fall 2016
Order Matters! V V Rotate (0,0,1, 30); Translate (10, 0, 0); drawPlant( ); Translate (10, 0, 0); Rotate (0,0,1, 30); drawPlant( ); Fall 2016
兩種詮釋法 Translate (10,5) Rotate (z, 30) draw [transform點座標] V Fall 2016 Also give ways to compute the world pos, given local coord
Case 1: Translate (10, 0, 0); Translate (10, 0, 0); Rotate (0,0,1, 30); drawPlant( ); Translate (10, 0, 0); Rotate (0,0,1, 30); drawPlant( ); y x z Fall 2016
Case 2: Rotate (0,0,1, 30); Rotate (0,0,1, 30); Translate (10, 0, 0); drawPlant( ); Rotate (0,0,1, 30); Translate (10, 0, 0); drawPlant( ); y x z Fall 2016
3D Rotation Representations Euler angles Axis-angle 3X3 rotation matrix Unit quaternion Learning Objectives Representation (uniqueness) Perform rotation Composition Interpolation Conversion among representations … Spring 2016
Euler Angles Specify orientation in rotation angles along three axes Usually, refer to local axes Common used: RPY (roll, pitch, yaw) ZYZ (next page) Fall 2014
Euler Angles (ZYZ) a b g Fall 2014
[Euler Angles (ZYZ)] a=0 y’ z’’’ b=90 z’’’ z’’ g=90 y’’ Fall 2014 y’’’
[Performing Rotation with (a, b, g) ] Rot(z”,g) Rot(y’,b) Rot(z,a) = Rot(z,a) Rot(y,b) Rot(z,g) A three-page CAD article (1995) by Lee and Koh talked about this Fall 2014
Euler Angles Roll, pitch, yaw Why gimbal lock a problem? Roll, pitch, yaw Gimbal lock: reduced DOF due to overlapping axes 在目前這個configuration,飛機無法yaw Spring 2016
Loss of DOF in gimbal lock (url) Rotation (a, b, g, ‘XYZ’) When Rotation (0.4, 1.57, 0, ‘XYZ’) = Rotation (0, 1.57, 0.4, ‘XYZ’) Spring 2016
Axis-Angle Representation Rot(r,a) r: rotation axis (unit vector) a: rotation angle (rad. or deg.) follow right-handed rule DOF? 3 Rot(r,a)=Rot (-r,-a) Problem with null rotation: rot(r, 0), any r (many-to-one mapping) 單位向量:長度為1之向量 a r v’ v Fall 2014
Axis Angle (cont) Perform rotation Rodrigues rotation formula (next pages) Fall 2014
Rodrigues Rotation Formula Compute the transformed point v’, after the axis-angle rotation, Rot(r, a) r: rotation axis, unit vector 𝑣 ′ =𝑣 cos 𝛼+ 𝑟×𝑣 sin 𝛼+𝑟 𝑟∙𝑣 1− cos 𝛼 a r v’ v Alternative formula v’=R v
Example (Rodrigues Formula) 𝑣 ′ =𝑣 cos 𝛼+ 𝑟×𝑣 sin 𝛼+𝑟 𝑟∙𝑣 1− cos 𝛼 r v’ v y 𝑅𝑜𝑡 1,0,0 , 𝜋 2 1 1 0 = 1 1 0 cos 𝜋 2 + 1 0 0 × 1 1 0 sin 𝜋 2 + 1 0 0 1 0 0 ∙ 1 1 0 1− cos 𝜋 2 x =0+ 𝑖 𝑗 𝑘 1 0 0 1 1 0 + 1 0 0 = 0 0 1 + 1 0 0 = 1 0 1 z Fall 2014
Axis-Angle Interpolation: poor Composition: poor Rot(n1,q1) & Rot(n2,q2) Rot(n1.5, q1.5) = ? Composition: poor Rot(n2,q2) Rot(n1,q1) =?= Rot(n3,q3) Fall 2014
[Euler’s Rotation Theorem] in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the fixed point. Spring 2016
2D Rotation orthogonal basis (after rotation) 𝑥=𝑟 cos ∅ 𝑦=𝑟 sin ∅ q f p 𝑥=𝑟 cos ∅ 𝑦=𝑟 sin ∅ r p’ q p f orthogonal basis (after rotation) Fall 2014
Extend to 3D Rotation Matrices y z x y z x y z 𝑅𝑜𝑡 𝑥,𝜃 = 1 0 0 0 cos 𝜃 − sin 𝜃 0 sin 𝜃 cos 𝜃 𝑅𝑜𝑡 𝑦,𝜃 = cos 𝜃 0 sin 𝜃 0 1 0 − sin 𝜃 0 cos 𝜃 𝑅𝑜𝑡 𝑧,𝜃 = cos 𝜃 −sin 𝜃 0 sin 𝜃 cos 𝜃 0 0 0 1 orthogonal basis Fall 2014
Rotation Matrix Three columns represent the basis Perform rotation: linear algebra Composition: trivial orthogonalization might be required due to FP errors Fall 2014
Example x y,x’ z,z’ y’ p(2,1,1) Rot(z,90°) Fall 2014
Rotation Matrix DOF? Interpolation: 9 numbers, but with these constraints, leaves 3 Interpolation: R1 & R2 R1.5 = ? Fall 2014
Gram-Schmidt Orthogonalization Given three independent vectors: u1, u2, u3 If 3x3 rotation matrix is no longer orthonormal, metric properties(volume, length, angle) might change! Fall 2014
[Proof (matrix version)] Rotation matrix is an orthogonal matrix [Proof (matrix version)] 1 is an eigenvalue of R x is the corresponding eigenvector (the rotation axis) Spring 2016
Quaternion A mathematical entity invented by Hamilton Definition i k j Fall 2014
Quaternion (cont) Operators Addition Multiplication Conjugate Length Fall 2014
Unit Quaternion as Rotation Define unit quaternion as follows to represent rotation Example Rot(z,90°) q and –q represent the same rotation DOF? 3 Fall 2014
In-class examples Rot(z,90°) Rot(z,-90°) Rot(x,180°) Rot(-z,-90°) Same as rot(z,90) Spring 2016
Important values & equalities Sin(q) Cos(q) 1 p/6 1/2 Sqrt(3)/2 p/4 Sqrt(2)/2 p/3 ½ p/2 Spring 2016
Unit Quaternion: rotating Fall 2014
Unit Quaternion: composition Fall 2014
Slerp (Spherical Linear Interpolation) q r unit sphere in R4 The computed rotation quaternion rotates about a fixed axis at constant speed Fall 2014
Unit Quaternion: slerp Fall 2014
Null Rotation (q = 0) Fall 2014
Ex: q and –q are the same! Fall 2014
q & -q in slerp May want to consider slerp (t, -q, r) instead of slerp (t, q, r), for smoother interpolation Fall 2014
Unit Quaternion Conversion Axis-angle 3x3 matrix Fall 2014
Unit Quaternion & Axis-Angle Axis-angle quaternion: Quaternion axis-angle First, find axis (unit vector) Then, use both values of sine and cosine to find angle Example Fall 2014
Unit Quaternion3x3 Matrix Example Fall 2014
3x3 MatrixUnit Quaternion Find largest qi2; solve the rest Fall 2014
Exercise x y z Fall 2014
In-class Exercise y x z As we have shown, This corresponds to rot(z,90) (take the positive one) Spring 2016
quaternion→axis-angle Use both values of sine and cosine to determine the angle!! Spring 2016
Example x y z x y z Rot (90, 0,0,1) OR Rot (-90,0,0,-1) Spring 2016
Example x y,x’ z,z’ y’ p(2,1,1) Rot(z,90°) Spring 2016
Example x y,x’ z,z’ y’ y x,x’ z,y’ z’ Spring 2016
Matrix Conversion Spring 2016
Spatial Displacement Any displacement can be decomposed into a rotation followed by a translation Matrix Quaternion Spring 2016
Extra’s Spring 2016
From Mason’s book a g b Write a program … Spring 2016
y z x a x’’’ y’’’ z’’’ g b Spring 2016
Spring 2016
From previous page Spring 2016
From Lee and Koh (1995) Euler angles in ASF In v’=Mv convention Spring 2016