1 / 21

Animating with Quaternions

Animating with Quaternions. Given quaternion representations, interpolate through them. Cubic, interpolating. Use operations efficient with quaternion representation. Halfway between 2 quaternions. Spherical Linear interpolation. Review of Quaternion Math. (cos( q /2),sin( q /2)*A).

merton
Download Presentation

Animating with Quaternions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Animating with Quaternions Given quaternion representations, interpolate through them Cubic, interpolating Use operations efficient with quaternion representation Halfway between 2 quaternions Spherical Linear interpolation

  2. Review of Quaternion Math (cos(q/2),sin(q/2)*A) [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 = [-s,v]/||q||2

  3. 1-2y2-2z2 2xy-2wz 2xz+2wy 2yz-2wx 2xy+2wz 1-2x2-2z2 2yz+2wx 1-2x2-2y2 2xz-2wy Rotation Matrix of a Unit Quaternion [ w,x,y,z]

  4. Review of Quaternion Rotations Rotq(v) = v’ = q * [0,v] * q-1 Rotq(v) = Rotk*q(v) Rotqp(v) = Rotq(Rotp(v) )

  5. Quaternions as points on a 4D sphere Unit quaternion: q=(s,x,y,z), ||q|| = 1 Want equal increment along arc connecting two quaternions on surface of sphere spherical linear interpolation

  6. q p Note: Simply adding quaternions gives mid-rotation (because a scalar multiple of a quaternion represents the same rotation, you don’t need to divide by 2 to get the ‘average’ rotation) Linearly interpolate between quaternions q=(sq,xq,yq,zq), p=(sp,xp,yp,zp)

  7. Euler Angles: [x,y,z] = (1- a)[xa,ya,za] + a[xb,yb,zb] Linear interpolation of quaternion values would give unequal rotation increments - need to slerp (spherical linear interpolation) Interpolation Scalar: K = (1-a) A + a B (linear interpolation: lerp) Quaternions?:

  8. Quaternion : Power Operator [ cos(q/2), sin(q /2) * A] a = [cos(aq/2), sin(aq /2) * A] q a rotates to q orientation as a goes from 0 to 1 Remember: q and -q represent same orientation q a and (-q) a give different rotation sequences 0< q < p gives short squence; p < q <2 p gives long one Since first term in q is cos(q/2), q gives short sequence if first term is positive

  9. Quaternions as points on a 4D sphere Remember: Rot[s,v] == Rot[-s,-v] Use quaternion representations that are ‘close’ to each other: Given quaternion p, should you interpolate to q or -q? p and q are close if their 4D dot product is greater than zero.

  10. Scalar: K = (1-a) A + a B (lerp) Euler Angles: [x,y,z] = (1-a)[xa,ya,za] + a[xb,yb,zb] Quaternions: q = (qbqa-1) a qa (slerp) Interpolation of rotations q = slerp(qa,qb, a)

  11. p0 p1 p2 p3 -1 3 -3 1 p0 p1 p2 p3 3 -6 3 0 P(u) = [u3 u2 u 1] -3 3 3 0 1 0 0 0 Review of Bezier Interpolation Using Catmull-Romm interp of interior control points

  12. Bezier Interpolation of Quaternions

  13. Interpolation Background De Casteljau construction of Bezier curve u=1/3 P(1/3)

  14. u=1/2 P(1/2) Interpolation Background Easy to compute quaternion half-way point q1/2 = q0 + q01

  15. pn an pn+2 pn-1 an+1 bn+1 pn+1 1 Quaternion - cubic interpolation

  16. Quaternion Interpolation Automatically generating interior (spherical) control points Q n P n A n P n+1 Bisect the span P n-1 Double the arc

  17. Quaternion Interpolation Q n Double(q1,q2) = q2q1-1q2 P n Q n =Double(P n-1, P n) P n-1

  18. Q n P n A n P n+1 P n-1 Construct Midpoint q1 + q2 = [s1,x1,y1,z1] + [s2,x2,y2,z2] Bisect(p,q) = (p+q)/||p+q|| A n =Bisect(Q n, P n+1)

  19. Spherical Linear Interpolation

  20. Repeated mid-point interpolation For u = 1/4

  21. Quaternion Interpolation Linearly interpolating between 4 keys Cubic Bezier interpolation among same 4 keys

More Related