00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00022
00023
#ifndef __M3DMATH_QUATERNION_H__
00024
#define __M3DMATH_QUATERNION_H__
00025
00026
#include "m3dmath_common.h"
00027
00028
struct quaternion
00029 {
00030
float32 x, y, z, w;
00031
00032 quaternion();
00033 quaternion(
const quaternion &i_vVal );
00034 quaternion(
const float32 i_fX,
const float32 i_fY,
const float32 i_fZ,
const float32 i_fW );
00035
00036
const quaternion &operator =(
const quaternion &i_vVal );
00037
00038 operator float32*();
00039 operator const float32*() const;
00040
00041 quaternion operator +() const;
00042 quaternion operator -() const;
00043
00044 const quaternion &operator +=( const quaternion &i_vVal );
00045 const quaternion &operator -=( const quaternion &i_vVal );
00046 const quaternion &operator *=( const quaternion &i_qVal );
00047 const quaternion &operator *=( const
float32 i_fVal );
00048 const quaternion &operator /=( const
float32 i_fVal );
00049
00050 quaternion operator +( const quaternion &i_vVal ) const;
00051 quaternion operator -( const quaternion &i_vVal ) const;
00052 quaternion operator *( const quaternion &i_qVal ) const;
00053 quaternion operator *( const
float32 i_fVal ) const;
00054 quaternion operator /( const
float32 i_fVal ) const;
00055
00056
float32 length() const;
00057
float32 lengthsq() const;
00058
00059 quaternion &normalize();
00060 };
00061
00062 quaternion &qQuaternionIdentity( quaternion &o_qQuatOut );
00063 quaternion &qQuaternionRotationMatrix( quaternion &o_qQuatOut,
00064 const struct matrix44 &i_matMatrix );
00065 quaternion &qQuaternionSLerp( quaternion &o_qQuatOut, const quaternion &i_qQuatA,
00066 const quaternion &i_qQuatB, const
float32 i_fLerp );
00067
void QuaternionToAxisAngle( quaternion &i_qQuat, struct vector3 &o_vAxis,
00068
float32 &o_fAngle );
00069
00070 #include "m3dmath_quaternion.inl"
00071
00072 #endif