'\"! tbl | mmdoc '\"macro stdmacro .ie n \{\ . ds Cr \fB . ds Cb \fB .\} .el \{\ . ds Cr \f7 . ds Cb \f8 .\} .TH SbRotation(3IV) .SH NAME SbRotation \(em class for representing a rotation .SH INHERITS FROM SbRotation .SH SYNOPSIS .ps -1 \*(Cr#include .sp .in 1i \f1Methods from class SbRotation: .in 0.5i .sp .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbVec3f &axis, float radians) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const float v[4]) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(float q0, float q1, float q2, float q3) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbMatrix &m) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbVec3f &rotateFrom, const SbVec3f &rotateTo) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst float * .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr() const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(float &q0, float &q1, float &q2, float &q3) const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(float q0, float q1, float q2, float q3) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(SbVec3f &axis, float &radians) const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(SbMatrix &matrix) const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbinvert\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbinverse\*(Cr() const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const float q[4]) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbMatrix &m) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbVec3f &axis, float radians) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbVec3f &rotateFrom, const SbVec3f &rotateTo) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator *=\*(Cr(const SbRotation &q) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crint .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator ==\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crint .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator !=\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbBool .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbequals\*(Cr(const SbRotation &r, float tolerance) const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator *\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbmultVec\*(Cr(const SbVec3f &src, SbVec3f &dst) const .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbscaleAngle\*(Cr(float scaleFactor ) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crstatic SbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbslerp\*(Cr(const SbRotation &rot0, const SbRotation &rot1, float t) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crstatic SbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbidentity\*(Cr() .sp .SH DESCRIPTION Object that stores a rotation. There are several ways to specify a rotation: quaternion (4 floats), 4x4 rotation matrix, or axis and angle. All angles are in radians and all rotations are right-handed. .SH METHODS .ta 20m .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr() .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbVec3f &axis, float radians) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const float v[4]) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(float q0, float q1, float q2, float q3) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbMatrix &m) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Cr .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbSbRotation\*(Cr(const SbVec3f &rotateFrom, const SbVec3f &rotateTo) .br .in 1i \f1Constructors for rotation. The axis/radians constructor creates a rotation of angle radians about the given axis. The constructors that take four floats create a quaternion from those floats (careful, \&this differs from the four numbers in an axis/radian definition). Matrix constructor requires a valid rotation matrix. The rotateFrom/To constructor defines rotation that rotates from one vector into \&another. The \*(CrrotateFrom\f1 and \*(CrrotateTo\f1 vectors are normalized by the constructor before calculating the rotation. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crconst float * .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr() const .br .in 1i \f1Returns pointer to array of 4 components defining quaternion. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(float &q0, float &q1, float &q2, float &q3) const .br .in 1i \f1Returns 4 individual components of rotation quaternion. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(float q0, float q1, float q2, float q3) .br .in 1i \f1Sets value of rotation from 4 individual components of a quaternion. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(SbVec3f &axis, float &radians) const .br .in 1i \f1Returns corresponding 3D rotation axis vector and angle in radians. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbgetValue\*(Cr(SbMatrix &matrix) const .br .in 1i \f1Returns corresponding 4x4 rotation matrix. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbinvert\*(Cr() .br .in 1i \f1Changes a rotation to be its inverse. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbinverse\*(Cr() const .br .in 1i \f1Returns the inverse of a rotation. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const float q[4]) .br .in 1i \f1Sets value of rotation from array of 4 components of a quaternion. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbMatrix &m) .br .in 1i \f1Sets value of rotation from a rotation matrix. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbVec3f &axis, float radians) .br .in 1i \f1Sets value of vector from 3D rotation axis vector and angle in radians. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbsetValue\*(Cr(const SbVec3f &rotateFrom, const SbVec3f &rotateTo) .br .in 1i \f1Sets rotation to rotate one direction vector to another. The \*(CrrotateFrom\f1 and \*(CrrotateTo\f1 arguments are normalized before the rotation is calculated. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation & .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator *=\*(Cr(const SbRotation &q) .br .in 1i \f1Multiplies by another rotation; results in product of rotations. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crint .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator ==\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crint .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator !=\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i \f1Equality comparison operators. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbBool .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbequals\*(Cr(const SbRotation &r, float tolerance) const .br .in 1i \f1Equality comparison within given tolerance \(em the square of the length of the maximum distance between the two quaternion vectors. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(CrSbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cboperator *\*(Cr(const SbRotation &q1, const SbRotation &q2) .br .in 1i \f1Multiplication of two rotations; results in product of rotations. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbmultVec\*(Cr(const SbVec3f &src, SbVec3f &dst) const .br .in 1i \f1Multiplies the given vector by the matrix of this rotation. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crvoid .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(CbscaleAngle\*(Cr(float scaleFactor ) .br .in 1i \f1Keep the axis the same. Multiply the angle of rotation by the amount \*(CrscaleFactor\f1. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crstatic SbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbslerp\*(Cr(const SbRotation &rot0, const SbRotation &rot1, float t) .br .in 1i \f1Spherical linear interpolation: as \*(Crt\f1 goes from 0 to 1, returned value goes from \*(Crrot0\f1 to \*(Crrot1\f1. .sp .in 0.5i .in 1i+20n .ti 0.5i .ta 20m .ds Pt \*(Crstatic SbRotation .ie \w'\*(Pt'>=20n \{\ .ne 3 \*(Pt .ti 0.5i \c\ \} .el\{\ .ne 2 \*(Pt \c\ \} \*(Cbidentity\*(Cr() .br .in 1i \f1Returns a null rotation. .sp .in 0.5i .SH NOTES Rotations are stored internally as quaternions. .SH SEE ALSO \*(CbSbVec3f, SbMatrix