Rotation Data

From K-3D

Jump to: navigation, search

There are four types that we use to represent orientation:

  • k3d::matrix3, or better: k3d::matrix4 (convert from 3x3 matrix to the more general 4x4 matrix using k3d::rotation3D() function). Matrices are stored in column-major ordering, like OpenGL, unlike RenderMan.
  • k3d::euler_angles: represents a triple of rotations around mutually perpendicular axes. While this is the easiest representation to understand, it suffers from a number of problems including gimbal lock and non-intuitive interpolation.
  • k3d::quaternion: quaternions are the extension of complex numbers into 3-space. Internally a quaternion consists of 4 numbers, and it turns out that if you treat one of those numbers as a rotation angle around the axis defined by the other three you can do useful operations, such as "spherical interpolation" between orientations.
  • k3d::angle_axis: the angle-axis representation also stores an orientation as a single rotation around a single, arbitrary axis. Since this is how rotations are specified in OpenGL and RenderMan, and this representation does not suffer from gimbal lock, this is how orientations are stored internally in K-3D.
Personal tools