The HQuat class defines the data type of a Quaternion. More...

#include <HBhvUtility.h>

Public Member Functions

 HQuat ()
 
 HQuat (float X, float Y, float Z, float W)
 
 HQuat (HQuat const *p)
 
 HQuat (const HQuat &p)
 
const HQuatNormalize ()
 
HQuat operator* (const HQuat &q2) const
 
HQuat operator* (float v) const
 
HQuat operator+ (const HQuat &q2) const
 
HQuat operator- (const HQuat &q2) const
 
HQuat operator/ (float v) const
 
void Set (float X, float Y, float Z, float W)
 
void ToMatrix (float matrix[16])
 

Static Public Member Functions

static HQuat MatrixToQuaternion (float matrix[])
 
static HQuat Qexp (const HQuat &q)
 
static HQuat Qlerp (const HQuat &q1, const HQuat &q2, float fraction)
 
static HQuat Qlog (const HQuat &q)
 
static HQuat Qslerp (const HQuat &q1, const HQuat &q2, float fraction)
 
static HQuat QslerpNoInvert (const HQuat &q1, const HQuat &q2, float fraction)
 
static HQuat QslerpNoInvertExtraSpins (const HQuat &q1, const HQuat &q2, float fraction, int ExtraSpins)
 
static HQuat Qspline (const HQuat &qnm1, const HQuat &qn, const HQuat &qnp1)
 
static HQuat Qsquad (const HQuat &q1, const HQuat &q2, const HQuat &a, const HQuat &b, float fraction)
 

Public Attributes

float w
 
float x
 
float y
 
float z
 

Friends

HQuat operator* (float v, const HQuat &q)
 

Detailed Description

The HQuat class defines the data type of a Quaternion.

The HQuat class encapsulates the x,y,x,w values used to define a quaternion as well as various functions to perform algebrahic operations on quaternions

Constructor & Destructor Documentation

◆ HQuat() [1/4]

HQuat::HQuat ( )
inline

default constructor

◆ HQuat() [2/4]

HQuat::HQuat ( float  X,
float  Y,
float  Z,
float  W 
)
inline

constructor that accepts three floats

◆ HQuat() [3/4]

HQuat::HQuat ( HQuat const *  p)
inline

constructor that accepts a pointer to an HQuat object

References w, x, y, and z.

◆ HQuat() [4/4]

HQuat::HQuat ( const HQuat p)
inline

constructor that accepts an HQuat reference

References w, x, y, and z.

Member Function Documentation

◆ MatrixToQuaternion()

static HQuat HQuat::MatrixToQuaternion ( float  matrix[])
static

Convert matrix to quaternion

Returns
converted quaternion

◆ Normalize()

const HQuat& HQuat::Normalize ( )

normalizes an HQuat

◆ operator*() [1/2]

HQuat HQuat::operator* ( const HQuat q2) const
inline

Multiplies two quaternions

Parameters
q2Quaternion to multiply with
Returns
Result of multiplication

References w, x, y, and z.

◆ operator*() [2/2]

HQuat HQuat::operator* ( float  v) const
inline

Multiplies a quaternion with a float value

Parameters
vValue to multiply Quaternion with
Returns
Result of multiplication

◆ operator+()

HQuat HQuat::operator+ ( const HQuat q2) const
inline

Add one quaternion to another

Parameters
q2Quaternion to add
Returns
Result of addition

References w, x, y, and z.

◆ operator-()

HQuat HQuat::operator- ( const HQuat q2) const
inline

Subtracts one quaternion from another

Parameters
q2Quaternion to subtract with
Returns
Result of subtraction

◆ operator/()

HQuat HQuat::operator/ ( float  v) const
inline

Divides a quaternion by a float value

Parameters
vValue to divide Quaternion by
Returns
Result of multiplication

◆ Qexp()

static HQuat HQuat::Qexp ( const HQuat q)
static

Qexp(v*a) = [cos(a),vsin(a)]

Parameters
qQuaternion to perform exp on
Returns
Result of Exp

◆ Qlerp()

static HQuat HQuat::Qlerp ( const HQuat q1,
const HQuat q2,
float  fraction 
)
static

Linear interpolation between two HQuats

Parameters
q1First Quaternion for Interpolation
q2Second Quaternion for Interpolation
fractionInterpolation Distance (0 - 1)
Returns
Result of interplation

◆ Qlog()

static HQuat HQuat::Qlog ( const HQuat q)
static

Logarithm of a HQuat, given as: Qlog(q) = v*a where q = [cos(a),v*sin(a)]

Parameters
qQuaternion to perform log on
Returns
Result of logarithm

◆ Qslerp()

static HQuat HQuat::Qslerp ( const HQuat q1,
const HQuat q2,
float  fraction 
)
static

Spherical interpolation between two HQuats

Parameters
q1First Quaternion for Interpolation
q2Second Quaternion for Interpolation
fractionInterpolation Distance (0 - 1)
Returns
Result of interplation

◆ QslerpNoInvert()

static HQuat HQuat::QslerpNoInvert ( const HQuat q1,
const HQuat q2,
float  fraction 
)
static

Spherical interpolation between two HQuats This version of slerp, used by squad, does not check for theta > 90.

Parameters
q1First Quaternion for Interpolation
q2Second Quaternion for Interpolation
fractionInterpolation Distance (0 - 1)
Returns
Result of interplation

◆ QslerpNoInvertExtraSpins()

static HQuat HQuat::QslerpNoInvertExtraSpins ( const HQuat q1,
const HQuat q2,
float  fraction,
int  ExtraSpins 
)
static

Spherical interpolation between two HQuats This version of slerp, used by squad, does not check for theta > 90.

Parameters
q1First Quaternion for Interpolation
q2Second Quaternion for Interpolation
fractionInterpolation Distance (0 - 1)
Returns
Result of interplation

◆ Qspline()

static HQuat HQuat::Qspline ( const HQuat qnm1,
const HQuat qn,
const HQuat qnp1 
)
static

Given 3 HQuats, qn-1,qn and qn+1, calculate a control point to be used in spline interpolation

Parameters
qnm1qn-1 control point
qnqn control point
qnp1qn + 1 control point
Returns
Result of interplation

◆ Qsquad()

static HQuat HQuat::Qsquad ( const HQuat q1,
const HQuat q2,
const HQuat a,
const HQuat b,
float  fraction 
)
static

Spherical cubic interpolation between two HQuats

Parameters
q1First Quaternion for Interpolation
q2Second Quaternion for Interpolation
aFirst Control Point
bSecond Control Point
fractionInterpolation Distance (0 - 1)
Returns
Result of interplation

◆ Set()

void HQuat::Set ( float  X,
float  Y,
float  Z,
float  W 
)
inline

Set packs an HQuat object with coordinate values.

◆ ToMatrix()

void HQuat::ToMatrix ( float  matrix[16])

Convert Quaternion to matrix form

Parameters
matrixReturns result matrix

Friends And Related Function Documentation

◆ operator*

HQuat operator* ( float  v,
const HQuat q 
)
friend

Multiplies a quaternion with a float value

Parameters
vValue to multiply Quaternion with
qQuaternion to multiply with
Returns
Result of multiplication

Member Data Documentation

◆ w

float HQuat::w

Quaternion w Coordinate

Referenced by HQuat(), operator*(), and operator+().

◆ x

float HQuat::x

Quaternion x Coordinate

Referenced by HQuat(), operator*(), and operator+().

◆ y

float HQuat::y

Quaternion y Coordinate

Referenced by HQuat(), operator*(), and operator+().

◆ z

float HQuat::z

Quaternion z Coordinate

Referenced by HQuat(), operator*(), and operator+().


The documentation for this class was generated from the following file: