260 likes | 269 Views
Learn how to handle rotations, translations, and scaling independently using quaternion representation in object orientation. See methods for error management and transformation matrices in Euler Angles and axis-angle orientations.
E N D
ORIENTATION Interpolating rotations is difficullt Use Quaternions
Object Representation • Define object in world space • Object space data • Translation • Rotation • Scale Desired operations Interpolation Concatenation Handle rotation, translation, scale independently
<= repeat <= repeat <= repeat Error Management Method 1 M = rotate(Dq) Object = apply M to Object Method 2 D = rotate(Dq) M = rotate(q) M = D.M Object = apply M to object Method 3 q = q + Dq M = rotate(q) Object = apply M to object
Orientation Representation orientation
O1 O 1.5 O2 Interpolation
O1 O2 Concatenation
Orientation Representation Rotation Matrix Fixed Angles Euler Angles Axis-Angle Quaternion
c a b 0 d e f 0 g h i 0 0 0 0 1 Transformation Matrices
0 -1 0 0 0 0 1 0 1 0 0 0 -1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 Transformation Matrices 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1
Y X Z Fixed Angles E.g., (Z,Y,X) Rx(q1). Ry(q2). Rz(q3). P
Fixed Angles E.g., (0,90,0) Y Y Z Z X X
Fixed Angles E.g., (-45,90,0) Y Y Z Z X X
Gimbal Lock What do these do? E.g., (0,90,0) (e,90,0) Y (0,90+e,0) Z (0,90,e) X
Fixed Angles E.g., (-45,90,0) E.g., (0,90,0) Y Y Z-axis rotation Z X X Z
Fixed Angle Interpolation (0,90,0) to (90,0,90) (0,0,0) (0,90,0) (90,0,90)
Euler Angles use ordered triple of rotations about global axes, Any triple can be used that doesn’t immediately Repeat an axis e.g., (x,y,z) is fine, so is (x,y,z); (x,x,z) is not Y y Z z x X
Y y Z z x X Euler Angles (z,y,x) Rz(q1).P Rz(q1).Ry(q2). Rz(-q1).P’ Rz(q1). Ry(q2). Rz(-q1). Rz(q1).P Rz(q1). Ry(q2). P Rz(q1). Ry(q2). Rx(q3). Ry(- q2). Rz(-q1).P’’ Rz(q1). Ry(q2). Rx(q3). Ry(- q2). Rz(-q1). Rz(q1). Ry(q2). P Rz(q1). Ry(q2). Rx(q3). P
Axis-Angle Rotate object by q around A (Ax,Ay,Az,q) A q Y Z X Euler’s rotation theorem
Axis-Angle Interpolation 1. Interpolate axis from A1 to A2 Rotate axis about A1 x A2 to get A A1 q1 A Y q A2 A1 x A2 2. Interpolate angle from q1 to q2 to get q q2 Z X 3. Rotate object by q around A
Quaternions q =[s,v] =[s,x,y,z] A q (cos(q/2),sin(q/2)*A)
Quaternions [s1,v1] + [s2,v2] = [s1+s2,v1+v2] [s1,v1] * [s2,v2] = [s1*s2-v1.v2,s1*v2+s2*v1+v1Xv2] ||q|| = sqrt(s*s + x*x + y*y + z*z) q * [1,0,0,0] = q q-1 = [-s,v]/||q||2 q * q-1 = [1,0,0,0]
Quaternions - rotate a point v = (x,y,z) => [0,v] Rotq(v) = v’ = q * [0,v] * q-1
Composite transformations Rotq(Rotp(v)) = Rotq( p * [0,v] * p-1 ) = q p * [0,v] * p-1 q -1 = q p * [0,v] * (qp) -1 = Rotqp(v))
Quaternion Rotation q Unit quaternion => ||q|| Rot [s,v ]= Rot k*[s, v]= Rot [k*s, k*v] Rot [s,v ] == Rot [-s, -v]
Quaternion Interpolation Fixed angles (90,0,90) (0,90,0) quaternions [0.5,0.5,0.5,0.5] [0.7,0.0,0.7,0.0]
Quaternion Interpolation Linearly interpolating fixed angles from (0,90,0) to (90,0,90) Interpolating quaternions from (0.5,0.0,1.0,0.0) to (0.5,0.5,0.5,0.5) using sphereical linear interpolation