The Nebula Device 3: Math::quaternion Class Reference

The Nebula Device 3

Math::quaternion Class Reference

#include <xna_quaternion.h>


Detailed Description

Nebula's quaternion class.

(C) 2004 RadonLabs GmbH

Public Member Functions

 quaternion ()
 default constructor, NOTE: does NOT setup components!
 quaternion (scalar x, scalar y, scalar z, scalar w)
 construct from components
 quaternion (float4 const &rhs)
 construct from float4
 quaternion (XMVECTOR rhs)
 construct from XMVECTOR
void operator= (const quaternion &rhs)
 assignment operator
void operator= (XMVECTOR rhs)
 assign XMVECTOR
bool operator== (const quaternion &rhs) const
 equality operator
bool operator!= (const quaternion &rhs) const
 inequality operator
void load (const scalar *ptr)
 load content from 16-byte-aligned memory
void loadu (const scalar *ptr)
 load content from unaligned memory
void store (scalar *ptr) const
 write content to 16-byte-aligned memory through the write cache
void storeu (scalar *ptr) const
 write content to unaligned memory through the write cache
void stream (scalar *ptr) const
 stream content to 16-byte-aligned memory circumventing the write-cache
void set (scalar x, scalar y, scalar z, scalar w)
 set content
void set (float4 const &f4)
 set from float4
void set_x (scalar x)
 set the x component
void set_y (scalar y)
 set the y component
void set_z (scalar z)
 set the z component
void set_w (scalar w)
 set the w component
scalar & x ()
 read/write access to x component
scalar & y ()
 read/write access to y component
scalar & z ()
 read/write access to z component
scalar & w ()
 read/write access to w component
scalar x () const
 read-only access to x component
scalar y () const
 read-only access to y component
scalar z () const
 read-only access to z component
scalar w () const
 read-only access to w component
bool isidentity () const
 return true if quaternion is identity
scalar length () const
 returns length
scalar lengthsq () const
 returns length squared
void undenormalize ()
 un-denormalize quaternion (this is sort of a hack since Maya likes to return denormal quaternions)

Static Public Member Functions

static quaternion barycentric (const quaternion &q0, const quaternion &q1, const quaternion &q2, scalar f, scalar g)
 return quaternion in barycentric coordinates
static quaternion conjugate (const quaternion &q)
 return conjugate of a normalized quaternion
static scalar dot (const quaternion &q0, const quaternion &q1)
 return dot product of two normalized quaternions
static quaternion exp (const quaternion &q0)
 calculate the exponential
static quaternion identity ()
 returns an identity quaternion
static quaternion inverse (const quaternion &q)
 conjugates and renormalizes quaternion
static quaternion ln (const quaternion &q)
 calculate the natural logarithm
static quaternion multiply (const quaternion &q0, const quaternion &q1)
 multiply 2 quaternions
static quaternion normalize (const quaternion &q)
 compute unit length quaternion
static quaternion rotationaxis (const float4 &axis, scalar angle)
 build quaternion from axis and clockwise rotation angle in radians
static quaternion rotationmatrix (const matrix44 &m)
 build quaternion from rotation matrix
static quaternion rotationyawpitchroll (scalar yaw, scalar pitch, scalar roll)
 build quaternion from yaw, pitch and roll
static quaternion slerp (const quaternion &q1, const quaternion &q2, scalar t)
 interpolate between 2 quaternion using spherical interpolation
static void squadsetup (const quaternion &q0, const quaternion &q1, const quaternion &q2, const quaternion &q3, quaternion &aOut, quaternion &bOut, quaternion &cOut)
 setup control points for spherical quadrangle interpolation
static quaternion squad (const quaternion &q1, const quaternion &a, const quaternion &b, const quaternion &c, scalar t)
 interpolate between quaternions using spherical quadrangle interpolation
static void to_axisangle (const quaternion &q, float4 &outAxis, scalar &outAngle)
 convert quaternion to axis and angle

Constructor & Destructor Documentation

__forceinline Math::quaternion::quaternion ( XMVECTOR  rhs  ) 

construct from XMVECTOR

copy constructor !!!! copy constructor forbidden, otherwise passing point's to a function !!!! via Registers doesnt work