3ds Max C++ API Reference
quat.h File Reference
#include "GeomExport.h"
#include "maxheap.h"
#include "matrix3.h"
#include "assert1.h"
#include <iosfwd>

Classes

class  AngAxis
 
class  Quat
 

Functions

Quat operator* (float, const Quat &)
 
Quat operator* (const Quat &, float)
 
Quat operator/ (const Quat &, float)
 
Quat Inverse (const Quat &q)
 
Quat Conjugate (const Quat &q)
 
Quat LogN (const Quat &q)
 
Quat Exp (const Quat &q)
 
Quat Slerp (const Quat &p, const Quat &q, float t)
 
Quat LnDif (const Quat &p, const Quat &q)
 
Quat QCompA (const Quat &qprev, const Quat &q, const Quat &qnext)
 
Quat Squad (const Quat &p, const Quat &a, const Quat &b, const Quat &q, float t)
 
Quat qorthog (const Quat &p, const Point3 &axis)
 
Quat squadrev (float angle, const Point3 &axis, const Quat &p, const Quat &a, const Quat &b, const Quat &q, float t)
 
void RotateMatrix (Matrix3 &mat, const Quat &q)
 
void PreRotateMatrix (Matrix3 &mat, const Quat &q)
 
Quat QFromAngAxis (float ang, const Point3 &axis)
 
void AngAxisFromQ (const Quat &q, float *ang, Point3 &axis)
 
float QangAxis (const Quat &p, const Quat &q, Point3 &axis)
 
void DecomposeMatrix (const Matrix3 &mat, Point3 &p, Quat &q, Point3 &s)
 
Quat TransformQuat (const Matrix3 &m, const Quat &q)
 
Quat IdentQuat ()
 
void QuatToEuler (Quat &q, float *ang)
 
void EulerToQuat (float *ang, Quat &q)
 
M_STD_OSTREAMoperator<< (M_STD_OSTREAM &, const Quat &)
 

Function Documentation

◆ operator*() [1/2]

Quat operator* ( float  ,
const Quat  
)
Remarks
Multiplies the quaternion by a scalar.

◆ operator*() [2/2]

Quat operator* ( const Quat ,
float   
)
Remarks
Multiplies the quaternion by a scalar.

◆ operator/()

Quat operator/ ( const Quat ,
float   
)
Remarks
Divides the quaternion by a scalar.

◆ Inverse()

Quat Inverse ( const Quat q)
Remarks
Returns the inverse of the quaternion (1/q).

◆ Conjugate()

Quat Conjugate ( const Quat q)
Remarks
Returns the conjugate of a quaternion.

◆ LogN()

Quat LogN ( const Quat q)
Remarks
Returns the natural logarithm of UNIT quaternion.

◆ Exp()

Quat Exp ( const Quat q)
Remarks
Exponentiate quaternion (where q.w==0).

◆ Slerp()

Quat Slerp ( const Quat p,
const Quat q,
float  t 
)
Remarks
Spherical linear interpolation of UNIT quaternions.

As t goes from 0 to 1, qt goes from p to q.

slerp(p,q,t) = (p*sin((1-t)*omega) + q*sin(t*omega)) / sin(omega)

◆ LnDif()

Quat LnDif ( const Quat p,
const Quat q 
)
Remarks
Computes the "log difference" of two quaternions, p and q, as ln(qinv(p)*q).

◆ QCompA()

Quat QCompA ( const Quat qprev,
const Quat q,
const Quat qnext 
)
Remarks
Compute a, the term used in Boehm-type interpolation.

a[n] = q[n]* qexp(-(1/4)*( ln(qinv(q[n])*q[n+1]) +ln( qinv(q[n])*q[n-1] )))

◆ Squad()

Quat Squad ( const Quat p,
const Quat a,
const Quat b,
const Quat q,
float  t 
)
Remarks
Squad(p,a,b,q; t) = Slerp(Slerp(p,q;t), Slerp(a,b;t); 2(1-t)t).

◆ qorthog()

Quat qorthog ( const Quat p,
const Point3 axis 
)
Remarks
Rotate p by 90 degrees (quaternion space metric) about the specified axis.

◆ squadrev()

Quat squadrev ( float  angle,
const Point3 axis,
const Quat p,
const Quat a,
const Quat b,
const Quat q,
float  t 
)
Remarks
Quaternion interpolation for angles > 2PI.
Parameters:
float angle

Angle of rotation

const Point3& axis

The axis of rotation

const Quat& p

Start quaternion

const Quat& a

Start tangent quaternion

const Quat& b

End tangent quaternion

const Quat& q

End quaternion

float t

Parameter, in range [0.0,1.0]

◆ RotateMatrix()

void RotateMatrix ( Matrix3 mat,
const Quat q 
)
Remarks
Converts the quaternion to a matrix and multiples it by the specified matrix. The result is returned in mat.

◆ PreRotateMatrix()

void PreRotateMatrix ( Matrix3 mat,
const Quat q 
)
Remarks
Converts the quaternion to a matrix and multiples it on the left by the specified matrix. . The result is returned in mat.

◆ QFromAngAxis()

Quat QFromAngAxis ( float  ang,
const Point3 axis 
)
Remarks
Converts the [angle,axis] representation to the equivalent quaternion.

◆ AngAxisFromQ()

void AngAxisFromQ ( const Quat q,
float *  ang,
Point3 axis 
)
Remarks
Converts the quaternion to the equivalent [angle,axis] representation.

◆ QangAxis()

float QangAxis ( const Quat p,
const Quat q,
Point3 axis 
)
Remarks
Compute the [angle,axis] corresponding to the rotation from p to q. Returns angle, sets axis.

◆ DecomposeMatrix()

void DecomposeMatrix ( const Matrix3 mat,
Point3 p,
Quat q,
Point3 s 
)
Remarks
Decomposes a matrix into a rotation, scale, and translation (to be applied in that order). This only will work correctly for scaling which was applied in the rotated axis system. For more general decomposition see the function decomp_affine(). See Structure AffineParts.

◆ TransformQuat()

Quat TransformQuat ( const Matrix3 m,
const Quat q 
)
Remarks
Returns the transformation of the specified quaternion by the specified matrix.

◆ IdentQuat()

Quat IdentQuat ( )
inline
Remarks
Returns the identity quaternion (Quat(0.0,0.0,0.0,1.0)).
464 {
465  return (Quat(0.0, 0.0, 0.0, 1.0));
466 }
Definition: quat.h:173

◆ QuatToEuler()

void QuatToEuler ( Quat q,
float *  ang 
)
Remarks
Converts the quaternion to Euler angles. When converting a quaternion to Euler angles using this method, the correct order of application of the resulting three rotations is X, then Y, then Z. The angles are returned as ang[0]=x, ang[1]=y, ang[2]=z.

◆ EulerToQuat()

void EulerToQuat ( float *  ang,
Quat q 
)
Remarks
Converts Euler angles to a quaternion. The angles are specified as ang[0]=x, ang[1]=y, ang[2]=z. This method is implemented as:

void EulerToQuat(float *ang, Quat \&q, int order) {
Matrix3 mat(1);</b>\n\n
for (int i=0; i\<3; i++) {
switch (orderings[order][i]) {
case 0: mat.RotateX(ang[i]); break;
case 1: mat.RotateY(ang[i]); break;
case 2: mat.RotateZ(ang[i]); break;
}
}
q = Quat(mat);
}
Definition: matrix3.h:98
void EulerToQuat(float *ang, Quat &q, int type)

◆ operator<<()

M_STD_OSTREAM& operator<< ( M_STD_OSTREAM ,
const Quat  
)