3d orientation
play

3D orientation 48 rotational DOFs Each joint can have up to 3 DOFs - PowerPoint PPT Presentation

Joints = rotations Rotational DOFs are widely used in character animation 3 translational DOFs 3D orientation 48 rotational DOFs Each joint can have up to 3 DOFs 1 DOF: knee 2 DOF: wrist 3 DOF: arm representation of Orientation Translation


  1. Joints = rotations Rotational DOFs are widely used in character animation 3 translational DOFs 3D orientation 48 rotational DOFs Each joint can have up to 3 DOFs 1 DOF: knee 2 DOF: wrist 3 DOF: arm representation of Orientation Translation       x + t x 1 0 0 t x x Homogeneous coordinates (review) y + t y 0 1 0 t y y        =       z + t z 0 0 1 t z z Treat all transformations the same so that they can be easily      combined 1 0 0 0 1 1 4X4 matrix used to represent translation, scaling, and rotation translation   new point old point x matrix a point in the space is represented as y   p =   z   1

  2. Scaling Rotation       x � 1 0 0 0 x y � 0 cos θ − sin θ 0 y       X axis  =       z � sin θ cos θ 0 0 z            0 0 0 s x x s x x 1 0 0 0 1 1 0 0 0 s y y s y y        =       0 0 0 s z z s z z            x � cos θ sin θ 0 0 x 1 0 0 0 1 1 y � 0 1 0 0 y       Y axis  =       z � − sin θ 0 cos θ 0 z      1 0 0 0 1 1 new point scaling matrix old point  x �      cos θ − sin θ 0 0 x y � sin θ cos θ 0 0 y       Z axis  =       z � 0 0 1 0 z      1 0 0 0 1 1 Composite transformations Interpolation h 0 θ 0 φ 0 x 0 y 0 z 0 σ 0 A series of transformations on an φ 1 θ 1 σ 1 h 1 object can be applied as a series of In order to “move things”, we need both translation matrix multiplications θ 2 and rotation p : position in the global coordinate h 2 Interpolation the translation is easy, but what about x : position in the local coordinate p rotations? θ 3 φ 3 ( h 3 , 0 , 0) h 3 p = T ( x 0 , y 0 , z 0 ) R ( θ 0 ) R ( φ 0 ) R ( σ 0 ) T (0 , h 0 , 0) R ( θ 1 ) R ( φ 1 ) R ( σ 1 ) T (0 , h 1 , 0) R ( θ 2 ) T (0 , h 2 , 0) R ( θ 3 ) R ( φ 3 ) x

  3. Interpolation of orientation Interpolation of orientation Example: interpolate linearly from a positive 90 degree rotation How about interpolating each entry of the rotation about y axis to a negative 90 degree rotation about y matrix?   0 0 1 0   0 0 − 1 0 0 1 0 0 0 1 0 0         The interpolated matrix might no longer be − 1 0 0 0 1 0 0 0     0 0 0 1 0 0 0 1 orthonormal, leading to nonsense for the in- between rotations Linearly interpolate each   0 0 0 0 component and halfway 0 1 0 0     0 0 0 0   between, you get this... 0 0 0 1 Other representations Fixed angle Fixed Angle Angles used to rotate about fixed axes Euler angle Orientations are specified by a set of 3 ordered Axis angle parameters that represent 3 ordered rotations about fixed axes Quaternion Many possible orderings Exponential map

  4. Fixed angle Euler angle A rotation of 10, 45, 90 would be written as Same as fixed angles, except now the axes move with the object R z (90) R y (45) R x (10) since we first rotate about x, y, and then z axis An Euler angle is a rotation about a single Cartesian axis We can apply this rotation to a vector v : R z (90) R y (45) R x (10) v Create multi-DOF rotations by concatenating Euler angles evaluate each axis independently in a set order Properties of Euler angle Properties of Euler angle Euler angle rotations about moving axes written in Several tasks are easy to do with Euler angles reverse order are the same as the fixed axis rotations joint limits E x (10) E y (45) E z (90) = R z (90) R y (45) R x (10) Euclidean interpolation But problem of singularities occurs when two axes of rotation line up

  5. Gimbal Lock Gimbal lock When two rotational axis of an object pointing in the same direction, the rotation ends up losing one degree of A Gimbal is a hardware freedom implementation of Euler angles used for mounting gyroscopes or expensive globes Gimbal lock is a basic problem with representing 3D rotation using Euler angles or fixed angles Axis angle Properties of axis angle Represent orientation as a vector and a scalar vector is the axis to rotate about Can avoid Gimbal lock. Why? scalar is the angle to rotate by Can interpolate the vector and the scalar separately. y (A 1 , � 1 ) How? x z

  6. Axis angle interpolation Properties of axis angle B = A 1 × A 2 (A 1 , � 1 ) � A 1 · A 2 y (A 2 , � 2 ) � avoid Gimbal lock? φ = cos − 1 | A 1 || A 2 | interpolate the vector and the scalar separately? x z A k = R B ( k φ ) A 1 efficiently compose rotations? θ k = (1 − k ) θ 1 + k θ 2 quaternion Quaternion math 4 tuple of real numbers: w, x, y, z Unit quaternion | q | = 1 x 2 + y 2 + z 2 + w 2 = 1   w � � scalar x w   Multiplication q =  =   vector y v  z � � � � � � w 1 w 2 − v 1 · v 2 w 1 w 2 = w 1 v 2 + w 2 v 1 + v 1 × v 2 v 1 v 2 Same information as axis angles but in a different form r q 1 q 2 � = q 2 q 1 � � cos ( θ / 2) q = sin ( θ / 2) r q 1 ( q 2 q 3 ) = ( q 1 q 2 ) q 3 θ

  7. Quaternion math Quaternion Rotation y � ∗ � � � p w w Conjugate q ∗ = = � � v − v 0 q p = x p ( q ∗ ) ∗ = q z ( q 1 q 2 ) ∗ = q ∗ 2 q ∗ 1 � � cos ( θ / 2) If is a unit quaternion and q = q q − 1 = q ∗ sin ( θ / 2) r Inverse | q | then results in rotating about by qq p q − 1   θ p r 1 0 qq − 1 =    the unit length quaternion   0  0 proof: see Quaternions by Shoemaker Quaternion Rotation Quaternion composition � � � � � � 0 qq p q − 1 = w w If and are unit quaternion v p − v q 1 q 2 � � � � w p · v = the combined rotation of first rotating by v w p − p × v q 1 and then by is equivalent to q 2 � � w p · v − v · w p + v · p × v = 0 = w ( w p − pv ) + ( p · v ) v + v ( w p − p × v ) q 3 = q 2 · q 1 What about a quaternion product ? q 1 · q 2

  8. Matrix form Quaternion interpolation θ 1 ( θ 1 , φ 1 ) θ 2   w ( θ 2 , φ 2 ) x   q =   y   1-angle rotation can be 2-angle rotation can be represented z represented by a unit circle by a unit sphere  1 − 2 y 2 − 2 z 2  2 xy + 2 wz 2 xz − 2 wy 0 1 − 2 x 2 − 2 z 2 2 xy − 2 wz 2 yz + 2 wx 0   R ( q ) = Interpolation means moving on n-D sphere   1 − 2 x 2 − 2 y 2 2 xz + 2 wy 2 yz − 2 wx 0   0 0 0 1 Now imagine a 4-D sphere for 3-angle rotation Quaternion interpolation Quaternion interpolation Direct linear interpolation does not work Linearly interpolated intermediate points are not Moving between two points on the 4D unit sphere uniformly spaced when projected onto the circle a unit quaternion at each step - another point on the 4D unit sphere θ Spherical linear interpolation (SLERP) move with constant angular velocity along the great circle between the two points on the 4D unit sphere sin((1 − u ) θ ) sin( u θ ) slerp ( q 1 , q 2 , u ) = q 1 + q 2 sin θ sin θ Normalize to regain unit quaternion

  9. Quaternion constraints Properties of quaternion Cone constraint avoid Gimbal lock?   easily composed? w 1 − cos θ x = y 2 + z 2   q =   y θ 2   interpolate? z enforce joint limits? θ tan ( θ / 2) = q axis Twist constraint w Properties of quaternion Exponential map avoid Gimbal lock? Represent orientation as a vector easily composed? direction of the vector is the axis to rotate about interpolate? magnitude of the vector is the angle to rotate by enforce joint limits? Zero vector represents the identity rotation So what’s bad about Quaternion?

  10. Properties of exponential map How to choose a representation? Choose the best representation for the task No need to re-normalize the parameters input: Euler angles Fewer DOFs joint limits: Euler angles Good interpolation behavior interpolation: quaternion or exponential map quaternions or orientation matrix compositing: Singularities exist but can be avoided rendering: orientation matrix Summary What’s next? What is a Gimbal lock? How does a quaternion rotation avoid Gimbal lock? Physics! How does the interpolation work in each type of rotations?

Recommend


More recommend