Fovia's C++ Client/Server API
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
QUATD Struct Reference

Public Member Functions

QUATD add (const QUATD &b)
 
double B1 (double t)
 
double B2 (double t)
 
double B3 (double t)
 
double B4 (double t)
 
double dot (const QUATD &a)
 
QUATD exp ()
 
QUATD innerQuadPoint (QUATD &q0, QUATD &q1, QUATD &q2)
 
void invert ()
 
QUATD lerp (QUATD &b, double t)
 
QUATD log ()
 
QUATD mul (const QUATD &b)
 
void normalize ()
 
QUATDoperator= (const QUATD &r)
 
 QUATD ()
 
 QUATD (double x, double y, double z, double w)
 
 QUATD (const QUATD &copy)
 
 QUATD (double angle, const VECTOR3D &axis)
 
void reset ()
 
QUATD scale (double s)
 
QUATD scatrom (QUATD &prev, QUATD &b, QUATD &next, double t)
 
void setAxis (double degrees, double fX, double fY, double fZ)
 
QUATD slerp (QUATD &b, double t)
 
QUATD slerpNoInvert (QUATD &b, double t)
 
QUATD squad (QUATD &prev, QUATD &b, QUATD &next, double t)
 
QUATD sub (QUATD b)
 
MATRIX44D toMatrix ()
 
std::string toString ()
 

Static Public Member Functions

static QUATD quatFromBallPoints (const VECTOR3D &vFrom, const VECTOR3D &vTo)
 
static QUATD quatFromTrackBallPoints (const POINT &ptCenter, const POINT &ptPos, const POINT &ptPrev, double dRadius, double sensitivity)
 

Public Attributes

double w
 
double x
 
double y
 
double z
 

Detailed Description

Object that represents a quaternion with double precision floating point member fields.

Constructor & Destructor Documentation

QUATD::QUATD ( )
inline

Constructs a new quaternion. The member fields are not initialized.

QUATD::QUATD ( double  x,
double  y,
double  z,
double  w 
)
inline

Constructs a new quaternion where the member fields x,y,z,w are populated with the corresponding x,y,z,w parameters.

Parameters
xThe new x member field value.
yThe new y member field value.
zThe new z member field value.
wThe new w member field value.

References w, x, y, and z.

QUATD::QUATD ( const QUATD copy)
inline

Constructs a new quaternion where the member fields are copied from copy into the new object.

Parameters
copyThe x,y,z,w members of this variable are copied into the new x,y,z,w member of the returned object.
QUATD::QUATD ( double  angle,
const VECTOR3D axis 
)
inline

Constructs a new quaternion from the specified angle (in degrees) and axis pair.

Parameters
angleThe angle in degrees of the new quaternion.
axisThe axis of the new quaternion.

References setAxis(), VECTOR3D::x, VECTOR3D::y, and VECTOR3D::z.

Member Function Documentation

QUATD QUATD::add ( const QUATD b)
inline

Returns the result of a quaternion add of this quaternion with the one contained in the parameter b.

Parameters
bThe right hand side of the quaternion add operation.
Returns
The result of the add operation.

References w, x, y, and z.

Referenced by innerQuadPoint(), lerp(), scatrom(), slerp(), and slerpNoInvert().

double QUATD::B1 ( double  t)
inline

Returns the first Catmull-Rom interpolation coefficient for the value t.

Parameters
tThe value before the start point in the Catmull-Rom interpolation.
Returns
The coefficient to accumulate into the final interpolation output.

Referenced by scatrom().

double QUATD::B2 ( double  t)
inline

Returns the second Catmull-Rom interpolation coefficient for the value t.

Parameters
tThe start point in the Catmull-Rom interpolation.
Returns
The coefficient to accumulate into the final interpolation output.

Referenced by scatrom().

double QUATD::B3 ( double  t)
inline

Returns the third Catmull-Rom interpolation coefficient for the value t.

Parameters
tThe finish point in the Catmull-Rom interpolation.
Returns
The coefficient to accumulate into the final interpolation output.

Referenced by scatrom().

double QUATD::B4 ( double  t)
inline

Returns the fourth Catmull-Rom interpolation coefficient for the value t.

Parameters
tThe value after the finish point in the Catmull-Rom interpolation.
Returns
The coefficient to accumulate into the final interpolation output.

Referenced by scatrom().

double QUATD::dot ( const QUATD a)
inline

Returns the result of a quaternion dot product of this quaternion with the one contained in the parameter b.

Parameters
aThe right hand side of the quaternion dot product operation.
Returns
The result of the dot product operation.

References w, x, y, and z.

Referenced by scatrom(), slerp(), slerpNoInvert(), and squad().

QUATD QUATD::exp ( )
inline

Returns the exponent of this quaternion.

Returns
The exponent of this quaternion.

References x, y, and z.

Referenced by innerQuadPoint().

QUATD QUATD::innerQuadPoint ( QUATD q0,
QUATD q1,
QUATD q2 
)
inline

Returns the inner quad point necessary for spherical quadrangle interpolation.

References add(), exp(), log(), mul(), scale(), w, x, y, and z.

Referenced by squad().

void QUATD::invert ( )
inline

Inverts the axis of this quaternion by multiplying x,y and z by -1. w is unchanged.

References x, y, and z.

QUATD QUATD::lerp ( QUATD b,
double  t 
)
inline

Returns the result of a linear interpolation between this quaternion and the one contained in b. If t is 0, this quaternion is returned. If t is 1, the quaternion b is returned.

Parameters
bThe quaternion that represents interpolation by a t value of 1.
tThe interpolation coefficient. At t=0, this quaternion is returned. At t=1, b is returned.
Returns
The result of the linear interpolation.

References add(), and scale().

Referenced by slerpNoInvert().

QUATD QUATD::log ( )
inline

Returns the logarithm of this quaternion.

Returns
The logarithm of this quaternion.

References w, x, y, and z.

Referenced by innerQuadPoint().

QUATD QUATD::mul ( const QUATD b)
inline

Returns the result of a quaternion multiply of this quaternion with the one contained in the parameter b.

Parameters
bThe right hand side of the quaternion multiply operation.
Returns
The result of the multiply operation.

References w, x, y, and z.

Referenced by innerQuadPoint().

void QUATD::normalize ( )
inline

Performs a mutable normalization of this quaternion.

References scale(), w, x, y, and z.

static QUATD QUATD::quatFromBallPoints ( const VECTOR3D vFrom,
const VECTOR3D vTo 
)
inlinestatic

Returns a quaternion that represents the trackball rotation from point vFrom to point vTo.

Parameters
vFromThe start trackball location.
vToThe end trackball location.
Returns
The quaternion that represents the trackball rotation from point vFrom to point vTo.

References w, VECTOR3D::x, x, VECTOR3D::y, y, VECTOR3D::z, and z.

Referenced by quatFromTrackBallPoints().

static QUATD QUATD::quatFromTrackBallPoints ( const POINT ptCenter,
const POINT ptPos,
const POINT ptPrev,
double  dRadius,
double  sensitivity 
)
inlinestatic

Returns a quaternion that represents the trackball rotation from point ptPrev to point ptPos.

Parameters
ptCenterThe center of the virtual trackball.
ptPosThe new location of the mouse.
ptPrevThe previous location of the mouse.
dRadiusThe radius of the trackball.
sensitivityThe sensitivity of the trackball.
Returns
The quaternion that represents the trackball rotation from point vFrom to point vTo.

References quatFromBallPoints(), POINT::x, VECTOR3D::x, POINT::y, VECTOR3D::y, and VECTOR3D::z.

void QUATD::reset ( )
inline

Sets the members of this quaternion to (0,0,0,1).

References w, x, y, and z.

QUATD QUATD::scale ( double  s)
inline

Returns a new quaternion where each member of the new quaternion is the result of the corresponding member of this object multiplied by s.

Parameters
sThe value by which each member variable will be multiplied.
Returns
The result of the scaling operation.

References w, x, y, and z.

Referenced by innerQuadPoint(), lerp(), normalize(), scatrom(), slerp(), slerpNoInvert(), and squad().

QUATD QUATD::scatrom ( QUATD prev,
QUATD b,
QUATD next,
double  t 
)
inline

Performs spherical Catmull-Rom interpolation using this quaternion as the start point. This is useful in performing smooth interpolation between orientation vectors.

Parameters
prevThe point before the this quaternion in the series.
bThe point after this quaternion in the series.
nextThe next point after b in this series.
tThe interpolation coefficient. If t=0, this quaternion is returned. If t=1, b is returned.
Returns
The result of the spherical Catmull-Rom interpolation.

References add(), B1(), B2(), B3(), B4(), dot(), and scale().

void QUATD::setAxis ( double  degrees,
double  fX,
double  fY,
double  fZ 
)
inline

Sets the angle (in degrees) of this quaternion to degrees and the axis to fX, fY, fZ.

Parameters
degreesThe angle in degrees to apply to this quaternion.
fXThe x component of the axis to apply to this quaternion.
fYThe y component of the axis to apply to this quaternion.
fZThe z component of the axis to apply to this quaternion.

References w, x, y, and z.

Referenced by QUATD().

QUATD QUATD::slerp ( QUATD b,
double  t 
)
inline

Returns the result of a spherical linear interpolation (with inversion) between this quaternion and the one contained in b. If t is 0, this quaternion is returned. If t is 1, the quaternion b is returned.

Parameters
bThe quaternion that represents interpolation by a t value of 1.
tThe interpolation coefficient. At t=0, this quaternion is returned. At t=1, b is returned.
Returns
The result of the spherical linear interpolation.

References add(), dot(), and scale().

Referenced by squad().

QUATD QUATD::slerpNoInvert ( QUATD b,
double  t 
)
inline

Returns the result of a spherical linear interpolation (without inversion) between this quaternion and the one contained in b. If t is 0, this quaternion is returned. If t is 1, the quaternion b is returned.

Parameters
bThe quaternion that represents interpolation by a t value of 1.
tThe interpolation coefficient. At t=0, this quaternion is returned. At t=1, b is returned.
Returns
The result of the spherical linear interpolation.

References add(), dot(), lerp(), and scale().

Referenced by squad().

QUATD QUATD::squad ( QUATD prev,
QUATD b,
QUATD next,
double  t 
)
inline

Performs spherical quadrangle interpolation using this quaternion as the start point. This is useful in performing smooth interpolation between orientation vectors.

Parameters
prevThe point before the this quaternion in the series.
bThe point after this quaternion in the series.
nextThe next point after b in this series.
tThe interpolation coefficient. If t=0, this quaternion is returned. If t=1, b is returned.
Returns
The result of the spherical quadrangle interpolation.

References dot(), innerQuadPoint(), scale(), slerp(), and slerpNoInvert().

QUATD QUATD::sub ( QUATD  b)
inline

Returns the result of a quaternion subtract of this quaternion with the one contained in the parameter b.

Parameters
bThe right hand side of the quaternion subtract operation.
Returns
The result of the subtract operation.

References w, x, y, and z.

MATRIX44D QUATD::toMatrix ( )
inline

Returns a matrix that represents the rotation represented in this quaternion.

Returns
A matrix that represents the rotation represented in this quaternion.

References w, x, y, and z.

std::string QUATD::toString ( )
inline

Returns a new string that describes the values contained in this object.

Returns
A string describing the values contained in this object.

References w, x, y, and z.

Member Data Documentation

double QUATD::w
double QUATD::x
double QUATD::y
double QUATD::z