Re: Alternative Orientation Systems

New Message Reply Date view Thread view Subject view Author view

Allan Schaffer (aschaffe)
Wed, 4 Jan 1995 17:03:21 -0800


On Jan 4, 6:21pm, Michael J. Smith wrote:
> Has there been any attention to allowing the use of Quaternians in the
> next release of Performer? And if so, will they be instead of Euler
> Angles or in addition to them? Using quaternians in my application would
> be more efficient, but needing to change to Euler Angles or a Rotation
> Matrix from the quaternian each frame might be a large performance hit.
> What is the Performer Groups position on this subject? (I really mean the
> Performer library programmers, but general responses are certainly welcome)

mtj has added a bevy of quaternion operators to the Performer math
library for 2.0 -- I'll append a preliminary API listing below:

/* quaternion access functions */
void pfSetQuat(pfQuat dst, float x, float y, float z, float w);
void pfGetQuat(const pfQuat q, float *x, float *y, float *z, float *w);
void pfCopyQuat(pfQuat dst, const pfQuat q);

/* quaternion unary (monadic) operators */
void pfNegateQuat(pfQuat dst, const pfQuat q);
float pfLengthQuat(const pfQuat q);
void pfConjQuat(pfQuat dst, const pfQuat q);
void pfExpQuat(pfQuat dst, const pfQuat q);
void pfLogQuat(pfQuat dst, const pfQuat q);

/* quaternion binary (dyadic) operators with scalars */
void pfAddQuatScalar(pfQuat dst, const pfQuat q, float s);
void pfSubQuatScalar(pfQuat dst, const pfQuat q, float s);
void pfMultQuatScalar(pfQuat dst, const pfQuat q, float s);
void pfDivQuatScalar(pfQuat dst, const pfQuat q, float s);

/* quaternion binary (dyadic) operators with quaternions */
void pfAddQuat(pfQuat dst, const pfQuat q1, const pfQuat q2);
void pfSubQuat(pfQuat dst, const pfQuat q1, const pfQuat q2);
void pfMultQuat(pfQuat dst, const pfQuat q1, const pfQuat q2);
void pfInvertQuat(pfQuat dst, const pfQuat q);
void pfDivQuat(pfQuat dst, const pfQuat q1, const pfQuat q2);

/* quaternion comparison operators */
long pfEqualQuat(const pfQuat q1, const pfQuat q2);
long pfAlmostEqualQuat(const pfQuat q1, const pfQuat q2, float tol);

/* convert quaternion to and from axis+angle representation */
void pfMakeRotQuat(pfQuat dst, float angle, float x, float y, float z);
void pfGetQuatRot(const pfQuat q, float *angle, float *x, float *y, float *z);

/* convert quaternion to and from rotation matrix representation */
void pfGetOrthoMatQuat(const pfMatrix m, pfQuat dst);
void pfMakeQuatMat(pfMatrix m, const pfQuat q);

/* interpolation operations */
void pfSlerpQuat(pfQuat dst, float t, const pfQuat q1, const pfQuat q2);
void pfSquadQuat(pfQuat dst, float t, const pfQuat q1, const pfQuat q2,
    const pfQuat a, const pfQuat b);
void pfQuatMeanTangent(pfQuat dst, const pfQuat q1, const pfQuat q2,
    const pfQuat q3);

Allan

-- 
Allan Schaffer
Silicon Graphics
aschaffe++at++sgi.com
http://reality.sgi.com/employees/aschaffe

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:49 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.