Detailed Description
- See also:
- Class Point3, Class
Matrix3, Class
AngAxis.
- Description:
- This class provides a compact representation for orientation in
three space and provides methods to perform Quaternion
algebra.
Quaternions provide an alternative representation for orientation
in three-space. To reduce computing, you can substitute quaternion
multiplication for rotation-matrix composition.
A quaternion is made up of four terms: a real scalar part which
specifies the amount of rotation and an imaginary vector part which
defines the axis of rotation. If the quaternion is normalized, the
scalar term equals the cosine of half the angle of rotation, the
vector term is the axis of rotation, and the magnitude of the
vector term equals the sine of half the angle of rotation.
Interpolation between two key frame orientations is much easier
using quaternions and produces smooth and natural motion. Unlike
Euler angles, no numerical integration is necessary; quaternions
provide an analytic result (no approximations).
The rotation convention in the 3ds Max API is the left-hand-rule.
Note that this is different from the right-hand-rule used in the
3ds Max user interface.
For additional information see: Quaternion operations:
From "Quaternion Calculus and Fast Animation",
by Ken Shoemake, in notes for SIGGRAPH 1987 Course # 10,
"Computer Animation: 3-D Motion Specification and Control".
All methods of this class are implemented by the system.
- Data Members:
- float x,y,z,w;
The x, y, z values make up the vector portion.
w is the angle of rotation about the vector (see remarks
above for details).
#include <quat.h>
List of all members.
Public Member Functions
|
|
Quat
() |
|
Quat (float
X, float Y, float Z, float W) |
|
Quat
(double X, double Y, double Z, double W) |
|
Quat (const
Quat &a) |
|
Quat (float
af[4]) |
GEOMEXPORT |
Quat (const
Matrix3 &mat) |
GEOMEXPORT |
Quat (const
AngAxis &aa) |
GEOMEXPORT |
Quat (const
Point3 &V, float
W) |
float
& |
operator[]
(int i) |
const float
& |
operator[]
(int i) const |
float |
Scalar
() |
Point3 |
Vector
() |
|
operator float
* () |
Quat |
operator-
() const |
Quat |
operator+
() const |
GEOMEXPORT
Quat |
Inverse ()
const |
GEOMEXPORT
Quat |
Conjugate
() const |
GEOMEXPORT
Quat |
LogN ()
const |
GEOMEXPORT
Quat |
Exp ()
const |
GEOMEXPORT
Quat & |
operator-=
(const Quat &) |
GEOMEXPORT
Quat & |
operator+=
(const Quat &) |
GEOMEXPORT
Quat & |
operator*=
(const Quat &) |
GEOMEXPORT
Quat & |
operator*=
(float) |
GEOMEXPORT
Quat & |
operator/=
(float) |
Quat & |
Set (float
X, float Y, float Z, float W) |
Quat & |
Set (double
X, double Y, double Z, double W) |
GEOMEXPORT
Quat & |
Set (const
Matrix3 &mat) |
GEOMEXPORT
Quat & |
Set (const
AngAxis &aa) |
Quat & |
Set (const
Point3 &V, float
W) |
GEOMEXPORT
Quat & |
SetEuler
(float X, float Y, float Z) |
GEOMEXPORT
Quat & |
Invert
() |
GEOMEXPORT
Quat & |
MakeClosest
(const Quat &qto) |
GEOMEXPORT
int |
operator==
(const Quat &a)
const |
GEOMEXPORT
int |
Equals
(const Quat &a, float
epsilon=1E-6f) const |
void |
Identity
() |
GEOMEXPORT
int |
IsIdentity
() const |
GEOMEXPORT
void |
Normalize
() |
GEOMEXPORT
void |
MakeMatrix
(Matrix3 &mat, bool
flag=false) const |
GEOMEXPORT
void |
GetEuler
(float *X, float *Y, float *Z) const |
GEOMEXPORT
Quat |
operator-
(const Quat &)
const |
GEOMEXPORT
Quat |
operator+
(const Quat &)
const |
GEOMEXPORT
Quat |
operator*
(const Quat &)
const |
GEOMEXPORT
Quat |
operator/
(const Quat &)
const |
GEOMEXPORT
float |
operator%
(const Quat &)
const |
GEOMEXPORT
Quat |
Plus (const
Quat &) const |
GEOMEXPORT
Quat |
Minus
(const Quat &)
const |
Public Attributes
|
float |
x |
float |
y |
float |
z |
float |
w |
Constructor & Destructor Documentation
: x(0.0f),y(0.0f),z(0.0f),w(1.0f) {}
Quat |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z, |
|
|
float |
W |
|
) |
|
[inline] |
{ x = X; y = Y; z = Z; w = W; }
Quat |
( |
double |
X, |
|
|
double |
Y, |
|
|
double |
Z, |
|
|
double |
W |
|
) |
|
[inline] |
{
x = (float)X; y = (float)Y; z = (float)Z; w = (float)W;
}
Quat |
( |
float |
af[4] |
) |
[inline] |
{ x = af[0]; y = af[1]; z = af[2]; w = af[3]; }
Member Function Documentation
float& operator[] |
( |
int |
i |
) |
[inline] |
const float& operator[] |
( |
int |
i |
) |
const [inline] |
float Scalar |
( |
|
) |
[inline] |
operator float * |
( |
|
) |
[inline] |
Quat
operator- |
( |
|
) |
const [inline] |
Quat
operator+ |
( |
|
) |
const [inline] |
GEOMEXPORT Quat Inverse |
( |
|
) |
const |
GEOMEXPORT Quat Conjugate |
( |
|
) |
const |
GEOMEXPORT Quat LogN |
( |
|
) |
const |
GEOMEXPORT Quat Exp |
( |
|
) |
const |
GEOMEXPORT Quat& operator-= |
( |
const Quat & |
|
) |
|
GEOMEXPORT Quat& operator+= |
( |
const Quat & |
|
) |
|
GEOMEXPORT Quat& operator*= |
( |
const Quat & |
|
) |
|
GEOMEXPORT Quat& operator*= |
( |
float |
|
) |
|
GEOMEXPORT Quat& operator/= |
( |
float |
|
) |
|
Quat& Set |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z, |
|
|
float |
W |
|
) |
|
[inline] |
{ x = X; y = Y; z = Z; w = W; return *this; }
Quat& Set |
( |
double |
X, |
|
|
double |
Y, |
|
|
double |
Z, |
|
|
double |
W |
|
) |
|
[inline] |
{ x = (float)X; y = (float)Y; z = (float)Z; w = (float)W;
return *this; }
{ x = V.x; y = V.y; z = V.z; w = W; return *this; }
GEOMEXPORT Quat& SetEuler |
( |
float |
X, |
|
|
float |
Y, |
|
|
float |
Z |
|
) |
|
|
GEOMEXPORT Quat& Invert |
( |
|
) |
|
GEOMEXPORT Quat& MakeClosest |
( |
const Quat & |
qto |
) |
|
GEOMEXPORT int operator== |
( |
const Quat & |
a |
) |
const |
GEOMEXPORT int Equals |
( |
const Quat & |
a, |
|
|
float |
epsilon =
1E-6f |
|
) |
|
const |
void Identity |
( |
|
) |
[inline] |
{ x = y = z = 0.0f; w = 1.0f; }
GEOMEXPORT int IsIdentity |
( |
|
) |
const |
GEOMEXPORT void Normalize |
( |
|
) |
|
GEOMEXPORT void MakeMatrix |
( |
Matrix3 & |
mat, |
|
|
bool |
flag = false |
|
) |
|
const |
- Parameters:
- Matrix3
&mat
The matrix.
BOOL b=FALSE
This parameter is available in release 4.0 and later only.
When this argument is set to false (or omitted), each function
performs as it did before version 4.0. When the boolean is TRUE,
the matrix is made with its terms transposed. When this
transposition is specified, EulerToQuat() and
QuatToEuler() are consistent with one another. (In 3ds Max
3, they have opposite handedness).
GEOMEXPORT void GetEuler |
( |
float * |
X, |
|
|
float * |
Y, |
|
|
float * |
Z |
|
) |
|
const |
GEOMEXPORT Quat operator- |
( |
const Quat & |
|
) |
const |
GEOMEXPORT Quat operator+ |
( |
const Quat & |
|
) |
const |
GEOMEXPORT Quat operator* |
( |
const Quat & |
|
) |
const |
GEOMEXPORT Quat operator/ |
( |
const Quat & |
|
) |
const |
GEOMEXPORT float operator% |
( |
const Quat & |
|
) |
const |
GEOMEXPORT Quat Plus |
( |
const Quat & |
|
) |
const |
GEOMEXPORT Quat Minus |
( |
const Quat & |
|
) |
const |
Member Data Documentation