3d orientation
play

3D orientation Rotation matrix Fixed angle and Euler angle Axis - PowerPoint PPT Presentation

3D orientation Rotation matrix Fixed angle and Euler angle Axis angle Quaternion Exponential map Joints and rotations Rotational DOFs are widely used in character animation 3 translational DOFs 48 rotational DOFs Each


  1. 3D orientation

  2. • Rotation matrix • Fixed angle and Euler angle • Axis angle • Quaternion • Exponential map

  3. Joints and rotations Rotational DOFs are widely used in character animation 3 translational DOFs 48 rotational DOFs Each joint can have up to 3 DOFs 1 DOF: knee 2 DOF: wrist 3 DOF: arm

  4. Representation of orientation • Homogeneous coordinates (review) • 4X4 matrix used to represent translation, scaling, and rotation   x y   • a point in the space is represented as p =   z   1 • Treat all transformations the same so that they can be easily combined

  5. Translation       x + t x 1 0 0 t x x y + t y 0 1 0 t y y        =       z + t z 0 0 1 t z z      1 0 0 0 1 1 translation new point old point matrix

  6. Scaling       0 0 0 s x x s x x 0 0 0 s y y s y y        =       0 0 0 s z z s z z      1 0 0 0 1 1 new point scaling matrix old point

  7. Rotation       x ′ 1 0 0 0 x y ′ 0 cos θ − sin θ 0 y       X axis  =       z ′ sin θ cos θ 0 0 z      1 0 0 0 1 1       x ′ cos θ 0 sin θ 0 x y ′ 0 1 0 0 y       Y axis  =       z ′ − sin θ cos θ 0 0 z      1 0 0 0 1 1       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

  8. Quiz • True or False: Given an arbitrary rotation matrix R • R is always orthonormal • R is always symmetric • RR T = I • R x (30)R y (60) = R y (60)R x (30)

  9. Interpolation • In order to “move things”, we need both translation and rotation • Interpolation the translation is easy, but what about rotations?

  10. Interpolation of orientation • How about interpolating each entry of the rotation matrix? • The interpolated matrix might no longer be orthonormal, leading to nonsense for the in- between rotations

  11. Interpolation of orientation Example: interpolate linearly from a positive 90 degree rotation about y axis to a negative 90 degree rotation about y     0 0 1 0 0 0 − 1 0 0 1 0 0 0 1 0 0         − 1 0 0 0 1 0 0 0     0 0 0 1 0 0 0 1 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

  12. Properties of rotation matrix • Easily composed? Yes • Interpolate? No

  13. • Rotation matrix • Fixed angle and Euler angle • Axis angle • Quaternion • Exponential map

  14. Fixed angle • Angles used to rotate about fixed axes • Orientations are specified by a set of 3 ordered parameters that represent 3 ordered rotations about fixed axes • Many possible orderings

  15. Euler angle • Same as fixed angles, except now the axes move with the object • An Euler angle is a rotation about a single Cartesian axis • Create multi-DOF rotations by concatenating Euler angles • evaluate each axis independently in a set order

  16. Euler angle vs. fixed angle • R z (90) R y (60) R x (30) = E x (30) E y (60) E z (90) • Euler angle rotations about moving axes written in reverse order are the same as the fixed axis rotations Z Y X

  17. Properties of Euler angle • Easily composed? No • Interpolate? Single rotation • How about joint limit? Easy • What seems to be the problem? Gimbal lock

  18. Gimbal Lock A Gimbal is a hardware 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

  19. Gimbal lock When two rotational axis of an object pointing in the same direction, the rotation ends up losing one degree of freedom

  20. • Rotation matrix • Fixed angle and Euler angle • Axis angle • Quaternion • Exponential map

  21. Axis angle • Represent orientation as a vector and a scalar • vector is the axis to rotate about • scalar is the angle to rotate by y x z

  22. Properties of axis angle • Can avoid Gimbal lock. Why? • It does 3D orientation in one step • Can interpolate the vector and the scalar separately. How?

  23. Axis angle interpolation θ k = (1 − k ) θ 1 + k θ 2 y A 2 θ 1 A 1 B = A 1 × A 2 θ 2 � A 1 · A 2 x � z φ = cos − 1 | A 1 || A 2 | A k = R B ( k φ ) A 1

  24. Properties of axis angle • Easily composed? No, must convert back to matrix form • Interpolate? Yes • Joint limit? Yes • Avoid Gimbal lock? Yes

  25. • Rotation matrix • Fixed angle and Euler angle • Axis angle • Quaternion • Exponential map

  26. Quaternion: geometric view θ 1 ( θ 1 , φ 1 ) θ 2 ( θ 2 , φ 2 ) 1-angle rotation can be 2-angle rotation can be represented by a unit circle represented by a unit sphere What about 3-angle rotation? A unit quaternion is a point on the 4D sphere

  27. Quaternion: algebraic view 4 tuple of real numbers: w, x, y, z ⎡ ⎤ w � w � scalar x ⎢ ⎥ q = ⎦ = ⎢ ⎥ vector y v ⎣ z Same information as axis angles but in a different form r � � cos ( θ / 2) q = sin ( θ / 2) r θ

  28. Basic quaternion definitions • Unit quaternion p x 2 + y 2 + z 2 + w 2 = 1 k q k = • Inverse quaternion q ∗ q − 1 = k q k 2 � w � ∗ � � Conjugate w q ∗ = = v − v • Identity   1 0 qq − 1 =     0   0

  29. Quaternion multiplication � � � � � � 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 • Commutativity q 1 q 2 ̸ = q 2 q 1 • Associativity q 1 ( q 2 q 3 ) = ( q 1 q 2 ) q 3

  30. Quaternion Rotation y r p � 0 θ � � � cos ( θ / 2) q p = q = x sin ( θ / 2) r z p If is a unit quaternion and q qq p q − 1 then results in rotating about by θ p r proof: see Quaternions by Shoemaker

  31. Quaternion Rotation � � � � � � 0 qq p q − 1 = w w v p − v � � � � w p · v = w p − p × v v � � w p · v − v · w p + v · p × v = 0 = w ( w p − p × v ) + ( p · v ) v + v × ( w p − p × v ) � � � � � � 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

  32. Quaternion composition If and are unit quaternion q 1 q 2 the combined rotation of first rotating by and q 1 then by is equivalent to q 2 q 3 = q 2 · q 1

  33. Matrix form   w x   q =   y   z   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 ) =   1 − 2 x 2 − 2 y 2 2 xz + 2 wy 2 yz − 2 wx 0   0 0 0 1

  34. Quaternion interpolation θ 1 ( θ 1 , φ 1 ) θ 2 ( θ 2 , φ 2 ) 1-angle rotation can be 2-angle rotation can be represented by a unit circle represented by a unit sphere • Interpolation means moving on n-D sphere

  35. Quaternion interpolation • Moving between two points on the 4D unit sphere • a unit quaternion at each step - another point on the 4D unit sphere • move with constant angular velocity along the great circle between the two points on the 4D unit sphere

  36. Quaternion interpolation Direct linear interpolation does not work Linearly interpolated intermediate points are not uniformly spaced when projected onto the circle θ Spherical linear interpolation (SLERP) sin((1 − u ) θ ) sin( u θ ) slerp ( q 1 , q 2 , u ) = q 1 + q 2 sin θ sin θ Normalize to regain unit quaternion

  37. Quaternion constraints e.g. a cone along-x axis Cone constraint   w 1 − cos θ x = y 2 + z 2   q =   2 y θ   z θ tan ( θ / 2) = q axis Twist constraint w q axis is the element of twist axis, e.g. z-axis

  38. Properties of quaternion • Easily composed? • Interpolate? • Joint limit? • Avoid Gimbal lock? • So what’s bad about Quaternion?

  39. • Rotation matrix • Fixed angle and Euler angle • Axis angle • Quaternion • Exponential map

  40. Exponential map • Represent orientation as a vector • direction of the vector is the axis to rotate about • magnitude of the vector is the angle to rotate by • Zero vector represents the identity rotation

  41. Properties of exponential map • No need to re-normalize the parameters • Fewer DOFs • Good interpolation behavior • Singularities exist but can be avoided

  42. Choose a representation • Choose the best representation for the task • common animation input: Euler angles • joint limits: Euler angles, axis angle, quaternion (harder) • interpolation: axis angle, quaternion • composition: quaternion or orientation matrix • avoid gimbal lock: axis and angle, quaternion • rendering: orientation matrix

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend