Download presentation
1
CSCE 441: Computer Graphics Rotation Representation and Interpolation
Jinxiang Chai
2
Toy Example A 2D lamp with 6 degrees of freedom lower arm middle arm
Upper arm base 2
3
Toy Example A 2D lamp with 6 degrees of freedom base
4
Toy Example A 2D lamp with 6 degrees of freedom Upper arm base
5
Toy Example A 2D lamp with 6 degrees of freedom middle arm Upper arm
base
6
Toy Example A 2D lamp with 6 degrees of freedom lower arm middle arm
Upper arm base
7
Joints and Rotation Rotational dofs are widely used in character animation 3 translation dofs 48 rotational dofs 1 dof: knee 2 dof: wrist 3 dof: shoulder
8
Orientation vs. Rotation
Orientation is described relative to some reference alignment A rotation changes object from one orientation to another Can represent orientation as a rotation from the reference alignment
9
Ideal Orientation Format
Represent 3 degrees of freedom with minimum number of values Allow concatenations of rotations Math should be simple and efficient concatenation interpolation rotation
10
Outline Rotation matrix Fixed angle and Euler angle Axis angle
Quaternion
11
Matrices as Orientation
Matrices just fine, right? No… 9 values to interpolate don’t interpolate well
12
Representation of orientation
Homogeneous coordinates (review): 4X4 matrix used to represent translation, scaling, and rotation a point in the space is represented as Treat all transformations the same so that they can be easily combined
13
Rotation New points rotation matrix old points
14
Interpolation In order to “move things”, we need both translation and rotation Interpolating the translation is easy, but what about rotations?
15
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 inbetween rotations
16
Interpolation of Orientation
Example: interpolate linearly from a positive 90 degree rotation about y axis to a negative 90 degree rotation about y Linearly interpolate each component and halfway between, you get this... Rotate about y-axis with 90 Rotate about y-axis with -90
17
Properties of Rotation Matrix
Easily composed? Interpolation? Compact representation?
18
Properties of Rotation Matrix
Easily composed? yes Interpolation? Compact representation?
19
Properties of Rotation Matrix
Easily composed? yes Interpolation? not good Compact representation?
20
Properties of Rotation Matrix
Easily composed? yes Interpolation? not good Compact representation? - 9 parameters (only needs 3 parameters)
21
Outline Rotation matrix Fixed angle and Euler angle Axis angle
Quaternion
22
Fixed Angles Angles are 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: x-y-z, x-y-x,y-x-z - as long as axis does immediately follow itself such as x-x-y
23
Fixed Angles 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-x. But x-x-z is not. X Z Y E.g., (qz, qy, qx) Q = Rx(qx). Ry(qy). Rz(qz). P
24
Euler Angles vs. Fixed Angles
One point of clarification Euler angle - rotates around local axes Fixed angle - rotates around world axes Rotations are reversed - x-y-z Euler angles == z-y-x fixed angles
25
Euler Angles vs. Fixed Angles
z-x-z Euler angles: (-60,30,45) z-x-z fixed angles: (45,30,-60)
26
Euler Angle Interpolation
Interpolating each component separately Might have singularity problem Halfway between (0, 90, 0) & (90, 45, 90) Interpolate directly, get (45, 67.5, 45) Desired result is (90, 22.5, 90) (verify this!)
27
Euler Angle Concatenation
Can't just add or multiply components Best way: Convert to matrices Multiply matrices Extract Euler angles from resulting matrix Not cheap
28
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 )
29
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 ) z y x
30
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 ) z y x z (90,0,0) y x
31
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 ) z y x z (90,0,0) (90,90,0) y y x z x
32
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 ) z y x z (90,0,0) (90,90,0) (90,90,90) y y y z x z x x
33
Gimbal Lock Euler/fixed angles not well-formed
Different values can give same rotation Example with z-y-x Euler angles: ( 90, 90, 90 ) = ( 0, 90, 0 ) z y x (0,90,0) y z x
34
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
35
Gimbal Lock When two rotational axis of an object pointing in the same direction, the rotation ends up losing one degree of freedom
36
Outline Rotation matrix Fixed angle and Euler angle Axis angle
Quaternion
37
Axis Angle Rotate an object by q around A (Ax,Ay,Az,q) A Y q Z X
The axis is really only 2 DoFs - its length is irrelevant Z X Euler’s rotation theorem: An arbitrary rotation may be described by only three parameters.
38
Axis-angle Rotation Given r – Vector in space to rotate
n – Unit-length axis in space about which to rotate q – The amount about n to rotate Solve r’ – The rotated vector r’ r n
39
Axis-angle Rotation Compute rpar: the projection of r along the n direction rpar = (n·r)n r’ rpar r
40
Axis-angle Rotation Compute rperp: rperp = r-rpar rperp rpar r’ r
41
Axis-angle Rotation Compute v: a vector perpedicular to rpar and rperp: v= rparxrperp v rperp rpar r’ r
42
Axis-angle Rotation Compute v: a vector perpedicular to rpar and rperp: v= rparxrperp v rperp rpar r’ Use rpar, rperp and v, θ to compute the new vector! r
43
Axis-angle Rotation rperp = r – (n·r) n q
V = n x (r – (n·r) n) = n x r r’ rpar = (n·r) n r n r’ = r’par + r’perp = r’par + (cos q) rperp + (sin q) V =(n·r) n + cos q(r – (n·r)n) + (sin q) n x r = (cos q)r + (1 – cos q) n (n·r) + (sin q) n x r
44
Axis-angle Rotation Can interpolate rotation well
45
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 the object by q around A
46
Axis-angle Rotation Can interpolate rotation well
Compact representation Messy to concatenate - might need to convert to matrix form
47
Outline Rotation matrix Fixed angle and Euler angle Axis angle
Quaternion
48
Quaternion Remember complex numbers: a+ib, where i2=-1
Quaternions are a non-commutative extension of complex numbers Invented by Sir William Hamilton (1843) Quaternion: - Q = a + bi + cj + dk: where i2=j2=k2=ijk=-1,ij=k,jk=i,ki=j - Represented as: q = (w, v) = w + xi + yj + zk
49
Quaternion 4 tuple of real numbers: w, x, y, z
Same information as axis angles but in a more computational-friendly form
50
Quaternion Math Unit quaternion Multiplication Non-commutative
Associative
51
Quaternion Math Conjugate Inverse
52
Quaternion Example let then
53
How to Represent Rotation?
Axis-angle q r’ r n r’ = r’par + r’perp = r’par + (cos q) rperp + (sin q) V =(n·r) n + cos q(r – (n·r)n) + (sin q) n x r = (cos q)r + (1 – cos q) n (n·r) + (sin q) n x r
54
Quaternion Rotation
55
Quaternion Rotation
56
Quaternion Example Rotate a point (1,0,0) about y-axis with -90 degrees z (0,0,1) y x (1,0,0)
57
Quaternion Example Rotate a point (1,0,0) about y-axis with -90 degrees z (0,0,1) y x (1,0,0)
58
Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees
z (0,0,1) y x (1,0,0) Point (1,0,0)
59
Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees
z (0,0,1) y x (1,0,0) Point (1,0,0) Quaternion rotation
60
Quaternion Example Rotate a point (1,0,0) about y-axis with 90 degrees
z (0,0,1) y x (1,0,0)
61
Quaternion Composition
Rotation by p then q is the same as rotation by qp
62
Matrix Form For a 3D point (x0,y0,z0)
63
Quaternion Interpolation
1-angle rotation can be represented by a unit circle
64
Quaternion Interpolation
1-angle rotation can be represented by a unit circle 2-angle rotation can be represented by a unit sphere
65
Quaternion Interpolation
1-angle rotation can be represented by a unit circle 2-angle rotation can be represented by a unit sphere Interpolation means moving on n-D sphere Now imagine a 4-D sphere for 3-angle rotation
66
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
67
Quaternion Interpolation
Direct linear interpolation does not work Linearly interpolated intermediate points are not uniformly spaced when projected onto the circle p0 p1
68
Quaternion Interpolation
Spherical linear interpolation (SLERP) - Constant speed motion along a unit radius great circle arc, given the ends and an interpolation parameter between 0 and 1 - Normalize to regain unit quaternion p0 p1 p1(p1-1p0)1-t
69
Quaternion Interpolation
Spherical linear interpolation (SLERP) Normalize to regain unit quaternion p0 p1 p1(p1-1p0)1-t
70
Quaternion Interpolation
Spherical linear interpolation (SLERP) Normalize to regain unit quaternion p0 p1 p1(p1-1p0)1-t
71
Quaternions Can interpolate rotation well Compact representation
Also easy to concatenate
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.