Presentation is loading. Please wait.

Presentation is loading. Please wait.

Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation.

Similar presentations


Presentation on theme: "Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation."— Presentation transcript:

1 Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation –rag doll physics –etc.

2 Euler Angles …so far, used one angle per axis, ie. Euler angles. Pros: –Simple! Cons: –Singularities (“gimbal lock”) –Interpolation is tricky –Composing rotations is tricky

3 Singularities Singularities may arise when axes are rotated to coincide Lose a degree of freedom Consider an airplane’s roll-pitch-yaw –eg. (0,90,0) vs. (90,90,90) – identical position IK problems: –Infinitely many solutions if coincident –Ill-posed when very close to coincident

4 Interpolation Vital for keyframe animation, blending mocap data, etc. Linear interpolating each angle independently gives odd behaviour near singularities Not “coordinate independent” –For 2 orientations, rotate-interpolate gives a different result than interpolate-rotate

5 Composition Given two rotations applied sequentially, find a single orientation that gives the same result. Not at all obvious how to handle this

6 3x3 Orthogonal Matrices Eliminate many issues of Euler angles, but… –Hard to work with: 9 components, 6 constraints –Highly redundant –Linear interpolation doesn’t work

7 3x3 Orthogonal Matrices But: – Very effective for quickly transforming many points –Composition is straightforward – multiply Still useful, but not as our primary representation

8 Axis-angle Unit axis vector and an angle indicating how much to rotate. Very intuitive 4 numbers, 1 constraint – less redundant Comparison, interpolation, composition still difficult.

9 2D Rotations Can use complex numbers to represent 2D rotations View a point (x,y) as x+ i*y Rotation about origin is multiplication by: –cos(theta) + i*sin(theta) Equivalently, e^(i*theta) –ie. A unit magnitude complex number

10 2D Rotations And composition is again multiplication Isn’t this overkill? –In 2D, yes –But this idea extends elegantly to 3D

11 Quaternions Generalizes complex numbers Two additional sqrt(-1) terms, j and k Form: a + bi + cj + dk Behave mostly like regular numbers: –But NOT commutative! a*b ≠ b*a

12 Quaternions Small set of simple multiplication rules: i*i = -1, j*j = -1, k*k = -1 i*j = k, j*k = i, k*i = j j*i = -k, k*j=-i, i*k = -j When j & k components are 0, this reverts to basic complex numbers –ie. 2D rotations.

13 Rotating points Given complex number: Conjugate is: Then: If q is unit magnitude, just gives back 0 + ix Real part remains 0, imaginary part retains its length, x

14 Rotating points Quaternion: Conjugate: Zero real-part quaternion: Consider: Real part stays 0, imaginary part keeps length For unit q, this is a rotation of the vector (x,y,z) in quaternion form

15 Quaternion Rotation So, to perform a rotation by unit quaternion q on vector v = (x,y,z) to get new vector v’ = (x’,y’,z’) just do:

16 Quaternion Rotation Unit-length quaternions can represent any orientation in 3D, without singularities Relation to axis-angle form: –Real part is cos(theta/2) –Imaginary part is vector parallel to the rotation axis Redundancy: q = -q –But since the two possible representations are maximally far apart, no harm done.

17 Quaternion Interpolation Interpolation is much more convenient –linear interpolating, then renormalizing q to unit-length works fairly well –For better results, ensure dot product of their imaginary parts is non-negative,by flipping sign, since q = -q is the same orientation. We want the two quaternion’s “axes” to be pointing in the same direction, so that the interpolation path is as short as possible. For improved interpolation of unit vectors, look into “slerp”

18 Quaternion Composition Similar to matrix form, just multiply Consider 2 quaternion rotations applied to a point 0+ix+jy+kz or


Download ppt "Orientations Goal: –Convenient representation of orientation of objects & characters in a scene Applications to: – inverse kinematics –rigid body simulation."

Similar presentations


Ads by Google