Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RtQuat
[Math Tools]


Data Structures

struct   RtQuat

Functions

RwBool  RtQuatConvertFromMatrix (RtQuat *const qpQuat, const RwMatrix *const mpMatrix)
RtQuat RtQuatRotate (RtQuat *quat, const RwV3d *axis, RwReal angle, RwOpCombineType combineOp)
const RtQuat RtQuatQueryRotate (const RtQuat *quat, RwV3d *unitAxis, RwReal *angle)
RwV3d RtQuatTransformVectors (RwV3d *vectorsOut, const RwV3d *vectorsIn, const RwInt32 numPoints, const RtQuat *quat)
RwReal  RtQuatModulus (RtQuat *q)
void  RtQuatInit (RtQuat *result, RwReal x, RwReal y, RwReal z, RwReal w)
void  RtQuatAssign (RtQuat *to, RtQuat *from)
void  RtQuatAdd (RtQuat *result, RtQuat *q1, RtQuat *q2)
void  RtQuatIncrementRealPart (RtQuat *result, RwReal s, RtQuat *q)
void  RtQuatDecrementRealPart (RtQuat *result, RwReal s, RtQuat *q)
void  RtQuatIncrement (RtQuat *result, RtQuat *dq)
void  RtQuatSub (RtQuat *result, RtQuat *q1, RtQuat *q2)
void  RtQuatNegate (RtQuat *result, RtQuat *q)
void  RtQuatConjugate (RtQuat *result, RtQuat *q)
void  RtQuatScale (RtQuat *result, RtQuat *q, RwReal scale)
RwReal  RtQuatModulusSquared (RtQuat *q)
void  RtQuatMultiply (RtQuat *result, RtQuat *q1, RtQuat *q2)
void  RtQuatReciprocal (RtQuat *result, RtQuat *q)
void  RtQuatSquare (RtQuat *result, RtQuat *q)
void  RtQuatSquareRoot (RtQuat *result, RtQuat *q)
void  RtQuatLog (RtQuat *result, RtQuat *q)
void  RtQuatExp (RtQuat *result, RtQuat *q)
void  RtQuatPow (RtQuat *result, RtQuat *q, RwReal e)
void  RtQuatUnitLog (RtQuat *result, RtQuat *q)
void  RtQuatUnitExp (RtQuat *result, RtQuat *q)
void  RtQuatUnitPow (RtQuat *result, RtQuat *q, RwReal e)
void  RtQuatConvertToMatrix (const RtQuat *const qpQuat, RwMatrix *const mpMatrix)
void  RtQuatUnitConvertToMatrix (const RtQuat *const qpQuat, RwMatrix *const mpMatrix)

Detailed Description

Quaternion Toolkit for RenderWare.

See also http://www.gamasutra.com/features/19980703/quaternions_01.htm

RtQuat Toolkit Overview

Requirements

Overview

This toolkit defines a new general-purpose quaternion datatype, RtQuat, and provides a number of useful functions for performing quaternion arithmetic and conversion to other formats.

Legacy applications should


Function Documentation

void RtQuatAdd RtQuat   result,
RtQuat   q1,
RtQuat   q2
 

RtQuatAdd calcuates the sum of an RtQuat pair

Parameters:
result  Target Quaternion
q1  First Source Quaternion
q2  Second Source Quaternion
See also:
RtQuatSub
void RtQuatAssign RtQuat   to,
RtQuat   from
 

RtQuatAssign assigns to an RtQuat from an RtQuat

Parameters:
to  Target Quaternion
from  Source Quaternion
See also:
RtQuatInit
void RtQuatConjugate RtQuat   result,
RtQuat   q
 

RtQuatConjugate conjugates an RtQuat to another RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatModulusSquared
RwBool RtQuatConvertFromMatrix RtQuat *const    qpQuat,
const RwMatrix *const    mpMatrix
 

RtQuatConvertFromMatrix converts to an RtQuat from an RwMatrix

Parameters:
qpQuat  Target quaternion.
mpMatrix  Source matrix.
Returns:
Flags success
See also:
RtQuatConvertToMatrix
void RtQuatConvertToMatrix const RtQuat *const    qpQuat,
RwMatrix *const    mpMatrix
 

RtQuatConvertToMatrix converts from an RtQuat to an RwMatrix

Parameters:
qpQuat  Source quaternion
mpMatrix  Target matrix
See also:
RtQuatConvertFromMatrix
void RtQuatDecrementRealPart RtQuat   result,
RwReal    s,
RtQuat   q
 

RtQuatDecrementRealPart decrements the real component of an RtQuat

Parameters:
result  Target Quaternion
s  Shift Factor
q  Source Quaternion
See also:
RtQuatIncrementRealPart
void RtQuatExp RtQuat   result,
RtQuat   q
 

RtQuatExp calculates the exponential of an RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatLog
void RtQuatIncrement RtQuat   result,
RtQuat   dq
 

RtQuatIncrement increments an RtQuat by another RtQuat

Parameters:
result  Target Quaternion
dq  Shift Quaternion
See also:
RtQuatAdd
void RtQuatIncrementRealPart RtQuat   result,
RwReal    s,
RtQuat   q
 

RtQuatIncrementRealPart increments the real component of an RtQuat

Parameters:
result  Target Quaternion
s  Scale Factor
q  Source Quaternion
See also:
RtQuatDecrementRealPart
void RtQuatInit RtQuat   result,
RwReal    x,
RwReal    y,
RwReal    z,
RwReal    w
 

RtQuatInit initializes the components of an RtQuat

Parameters:
result  Target Quaternion
x  First imaginary component
y  Second imaginary component
z  Third imaginary component
w  Real component
See also:
RtQuatAssign
void RtQuatLog RtQuat   result,
RtQuat   q
 

RtQuatLog calculates the logarithm of an RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatExp
RwReal RtQuatModulus RtQuat   q
 

RtQuatModulus returns the modulus of an RtQuat

Parameters:
q  Source Quaternion
Returns:
the modulus of the RtQuat
See also:
RtQuatModulusSquared
RwReal RtQuatModulusSquared RtQuat   q
 

RtQuatModulusSquared returns the square of the modulus of an RtQuat

Parameters:
q  Source Quaternion
Returns:
the square of the modulus of the RtQuat
See also:
RtQuatModulus
void RtQuatMultiply RtQuat   result,
RtQuat   q1,
RtQuat   q2
 

RtQuatMultiply calculates the (non-commutative) product of an RtQuat pair

Parameters:
result  Target Quaternion
q1  First Source Quaternion
q2  Second Source Quaternion
See also:
RtQuatReciprocal
void RtQuatNegate RtQuat   result,
RtQuat   q
 

RtQuatNegate negates an RtQuat to the additive inverse

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatAssign
void RtQuatPow RtQuat   result,
RtQuat   q,
RwReal    e
 

RtQuatPow calculates the power of an RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
e  Power exponent
See also:
RtQuatLog , RtQuatExp
const RtQuat* RtQuatQueryRotate const RtQuat   quat,
RwV3d   unitAxis,
RwReal   angle
 

RtQuatQueryRotate determines the rotation represented by a quaternion. The rotation is returned as a unit vector along the axis of rotation, and an angle of rotation. The rotation component has two possible descriptions since a rotation about an axis of theta degrees is equivalent to a rotation about an axis pointing in the opposite direction by an angle of 360-theta in the reverse direction. The angle returned by RtQuatQueryRotate is always between 0 and 180 degrees and the direction of the axis of rotation returned is chosen to ensure the angle is in this range.

Parameters:
quat  Pointer to quaternion to be investigated.
unitAxis  Pointer to vector which will receive the unit direction vector along axis of rotation.
angle  Pointer to RwReal which will receive angle of rotation in degrees.
Returns:
Returns pointer to the queried quaternion if successful or NULL if there is an error.
See also:
RtQuatRotate
void RtQuatReciprocal RtQuat   result,
RtQuat   q
 

RtQuatReciprocal recipricates an RtQuat to its multiplicative inverse

Parameters:
result  Target Quaternion
q  Source Quaternion
RtQuat* RtQuatRotate RtQuat   quat,
const RwV3d   axis,
RwReal    angle,
RwOpCombineType    combineOp
 

RtQuatRotate builds a rotation quaternion from the given axis and angle of rotation.

Parameters:
quat  Pointer to quat to apply rotation to.
axis  Pointer to vector specifying axis of rotation.
angle  Angle of rotation, in degrees.
combineOp  An RwOpCombineType flag.
Valid flags for "combineOp" are: rwCOMBINEREPLACE, rwCOMBINEPRECONCAT and rwCOMBINEPOSTCONCAT.
Returns:
Returns pointer to the new quat if successful or NULL if there is an error.
See also:
RtQuatQueryRotate
void RtQuatScale RtQuat   result,
RtQuat   q,
RwReal    scale
 

RtQuatScale scales an RtQuat by a factor to another RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
scale  Scale Factor
See also:
RtQuatMultiply
void RtQuatSquare RtQuat   result,
RtQuat   q
 

RtQuatSquare calculates the square of an RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatSquareRoot
void RtQuatSquareRoot RtQuat   result,
RtQuat   q
 

RtQuatSquareRoot calculates the square root of an RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatSquare
void RtQuatSub RtQuat   result,
RtQuat   q1,
RtQuat   q2
 

RtQuatSub calculates the difference of an RtQuat pair

Parameters:
result  Target Quaternion
q1  First Source Quaternion
q2  Second Source Quaternion
See also:
RtQuatAdd
RwV3d* RtQuatTransformVectors RwV3d   vectorsOut,
const RwV3d   vectorsIn,
const RwInt32    numPoints,
const RtQuat   quat
 

RtQuatTransformVectors uses the given quaternion describing a transformation and applies it to the specified array of vectors. The results are then placed in another array (which may be the same array as the source).

Note: The source and destination array may be separate or coincident, but the result is not defined if the source and destination overlap in any other way (ie, if they are offset from one another but still overlap).

Parameters:
vectorsOut  Pointer to an array of RwV3ds which are to receive the results of the vector transformation.
vectorsIn  Pointer to an array of RwV3ds which are to supply to vectors to be transformed.
numPoints  Number of vectors to transform.
quat  Pointer to the quaternion supplying the transformation.
Returns:
pointer to the transformed vectors if successful, or NULL if there is an error.
See also:
RwV3dTransformPoints , RwV3dTransformVectors
void RtQuatUnitConvertToMatrix const RtQuat *const    qpQuat,
RwMatrix *const    mpMatrix
 

RtQuatUnitConvertToMatrix converts from a unitary RtQuat to an RwMatrix

Parameters:
qpQuat  Source quaternion
mpMatrix  Target matrix
See also:
RtQuatConvertFromMatrix
void RtQuatUnitExp RtQuat   result,
RtQuat   q
 

RtQuatUnitExp calculates the exponential of a unitary RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatUnitLog
void RtQuatUnitLog RtQuat   result,
RtQuat   q
 

RtQuatUnitLog calculates the logarithm of a unitary RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
See also:
RtQuatUnitExp
void RtQuatUnitPow RtQuat   result,
RtQuat   q,
RwReal    e
 

RtQuatUnitPow calculates the power of a unitary RtQuat

Parameters:
result  Target Quaternion
q  Source Quaternion
e  Power exponent
See also:
RtQuatUnitLog , RtQuatUnitExp

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:47:00 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)