Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

quat3 Struct Reference

List of all members.

Detailed Description

A quaternion object.

The typical usage is to create an instance using quat3.rotationDeg or quat3.rotationRad. You can then convert it to a matrix using .tomat4 (matrices are faster at multiplication), multiply them together, multiply them against vectors, or interpolate them using lerpShort, lerpLong, lerpCW, lerpCCW, lerpLinear, or lerp.


Public Types

enum  Lerp {
  Short, Long, CW, CCW,
  Linear
}
 Parameter for lerp. More...


Public Member Functions

quat3 mul (quat3 b)
 Multiply quaternions, so that the result is like applying this quaternion and then the next one.

vec3 mul (vec3 vector)
 Rotate vector by this quaternion.

mat4 tomat4 ()
 Convert the quaternion to a 4x4 matrix.

mat3 tomat3 ()
 Convert the quaternion to a 3x3 matrix.

quat3 inverse ()
 Return the inverse of this quaternion, containing the opposite rotation.

float normal ()
 Return the normal of the quaternion.

quat3 conjugate ()
 Return the conjugate of the quaternion (w, -x, -y, -z).


Static Public Member Functions

quat3 rotationDeg (float x, float y, float z)
 Return a quaternion that rotates a number of degrees around each axis.

quat3 rotationDeg (vec3 amount)
 Return a quaternion that rotates a number of degrees around each axis.

quat3 rotationDeg (float amount, float x, float y, float z)
 Return a quaternion that rotates around an axis by a number of degrees.

quat3 rotationDeg (float amount, vec3 axis)
 Return a quaternion that rotates around an axis by a number of degrees.

quat3 rotationRad (float x, float y, float z)
 Return a quaternion that rotates a number of radians around each axis.

quat3 rotationRad (vec3 amount)
 Return a quaternion that rotates a number of radians around each axis.

quat3 rotationRad (float amount, float x, float y, float z)
 Return a quaternion that rotates around an axis by a number of radians.

quat3 rotationRad (float amount, vec3 axis)
 Return a quaternion that rotates around an axis by a number of radians.

quat3 frommat4 (mat4 matrix)
 Return the quaternion component from a 4x4 matrix.

quat3 lerpShort (quat3 a, quat3 b, float t)
 Interpolate between two quaternions using the shortest path between them.

quat3 lerpLong (quat3 a, quat3 b, float t)
 Interpolate between two quaternions using the longest path between them.

quat3 lerpCW (quat3 a, quat3 b, float t)
 Interpolate between two quaternions by rotating clockwise when viewed from above.

quat3 lerpCCW (quat3 a, quat3 b, float t)
 Interpolate between two quaternions by rotating counter-clockwise when viewed from above.

quat3 lerpLinear (quat3 a, quat3 b, float t)
 Interpolate between two quaternions linearly.

quat3 lerp (quat3 a, quat3 b, float t, Lerp how)
 Interpolate between two quaternions.


Public Attributes

float w = 1
 W factor.

float x = 0
 X factor.

float y = 0
 Y factor.

float z = 0
 Z factor.


Member Enumeration Documentation

enum quat3::Lerp
 

Parameter for lerp.

Enumeration values:
Short  Use the shortest path.
Long  Use the longest path.
CW  Rotate clockwise when viewed from above.
CCW  Rotate counter-clockwise when viewed from above.
Linear  Merely linearly interpolate the values.


Member Function Documentation

vec3 quat3.mul vec3  vector  ) 
 

Rotate vector by this quaternion.

This is a slow operation - convert this to a matrix (using tomat3 or tomat4) and apply that if you are going to be rotating many vectors.


The documentation for this struct was generated from the following file:
Generated on Thu Sep 4 13:12:53 2003 for dig by doxygen 1.3.2