Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

CS3242 Lecture 2: Quaternions Cheat Sheet

1. Introduction

  • Rotation Representations:
    • Matrix (3x3, 9 elements)
    • Euler Angles (3 angles, suffers from gimbal lock)
    • Axis-Angle Representation
    • Quaternions (4 elements, no gimbal lock, efficient)

2. Complex Numbers and Quaternions

  • Complex number: ( p = x + iy ) (2D rotations)
  • Quaternions extend complex numbers to 3D:
    • ( q = w + ix + jy + kz = (w, x, y, z) )
    • One real component (( w )), three imaginary (( x, y, z ))

3. Quaternion Algebra

  • Quaternion multiplication follows these rules:
    • ( i^2 = j^2 = k^2 = -1 )
    • ( ij = k, ji = -k )
    • ( jk = i, kj = -i )
    • ( ki = j, ik = -j )

4. Unit Quaternions

  • Unit quaternion: ( ||q|| = \sqrt{w^2 + x^2 + y^2 + z^2} = 1 )
  • Used for representing 3D rotations.

5. Quaternion as Rotations

  • A rotation by angle ( \theta ) around unit axis ( \mathbf{a} = (a_x, a_y, a_z) ) is: [ q = \cos(\theta/2) + (a_x i + a_y j + a_z k) \sin(\theta/2) ]
  • Applying quaternion rotation: [ p' = q p q^* ] where ( q^* = (w, -x, -y, -z) ) is the conjugate.

6. Converting Quaternion to Rotation Matrix

  • The corresponding rotation matrix for a quaternion ( q = (w, x, y, z) ) is: [ R = \begin{bmatrix} 1 - 2(y^2 + z^2) & 2(xy - wz) & 2(xz + wy) \ 2(xy + wz) & 1 - 2(x^2 + z^2) & 2(yz - wx) \ 2(xz - wy) & 2(yz + wx) & 1 - 2(x^2 + y^2) \end{bmatrix} ]

7. Quaternion Interpolation

7.1 Linear Interpolation (LERP)

  • Simple interpolation between two quaternions: [ LERP(q_1, q_2, t) = (1 - t)q_1 + t q_2 ]
  • Not ideal for rotations, as it doesn't maintain unit length.

7.2 Spherical Linear Interpolation (SLERP)

  • Interpolates along the shortest path on the quaternion sphere: [ SLERP(q_1, q_2, t) = \frac{\sin((1 - t)\theta)}{\sin\theta} q_1 + \frac{\sin(t\theta)}{\sin\theta} q_2 ]
  • Ensures smooth rotation.

8. Example: Rotating a Point Using Quaternions

  1. Define quaternion ( q ) for rotation.
  2. Convert point ( p = (0, x, y, z) ) into a pure quaternion.
  3. Compute rotated point: ( p' = q p q^* ).

9. Summary

  • Quaternions are a compact, efficient way to represent 3D rotations.
  • Avoids gimbal lock, provides smooth interpolation.
  • Essential for 3D animation, robotics, and physics simulations.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors