SbRotation(3IV)
SbRotation (SbRot) - class for representing a rotation
As shipped in IRIX 6.5.30. Added in IRIX 6.5.22.
NAME SbRotation (SbRot) - class for representing a rotation INHERITS FROM SbRotation SYNOPSIS #include <Inventor_c/SbLinear.h> typedef SbRotation SbRot Functions from class SbRotation: void SbRotGetAxisAngle(const SbRot *this, SbVec3f *axis, float *radians) void SbRotGetMx(const SbRot *this, SbMatrix *matrix) SbRotation * SbRotInvert(SbRot *this) SbRotation SbRotInverse(const SbRot *this) SbRotation * SbRotSetMx(SbRot *this, const SbMatrix *m) SbRotation * SbRotSetAxisAngle(SbRot *this, const SbVec3f *axis, float radians) SbRotation * SbRotSetFromTo(SbRot *this, const SbVec3f *rotateFrom, const SbVec3f *rotateTo) int SbRotIsEq(SbRot *this, const SbRotation *q1, const SbRotation *q2) int SbRotIsNEq(SbRot *this, const SbRotation *q1, const SbRotation *q2) SbBool SbRotEquals(const SbRot *this, const SbRotation *r, float tolerance) SbRotation SbRotMult(SbRot *this, const SbRotation *q1, const SbRotation *q2) void SbRotMultVec(const SbRot *this, const SbVec3f *src, SbVec3f *dst) void SbRotScaleAngle(SbRot *this, float scaleFactor ) SbRotation SbRotSlerp(const SbRotation *rot0, const SbRotation *rot1, float t) SbRotation SbRotIdent() Macros from class SbRotation: SbRotGetQuat(float *dest, SbRotation *src) SbRotGetQ_U_A_T(float q0, float q1, float q2, float q3, SbRotation *src) SbRotSetQuat(SbRotation *dest, float *src) SbRotSetQ_U_A_T(SbRotation *dest, float q0, float q1, float q2, float q3) 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. This object does not have Create or Delete functions because it is a simple datatype. C programmers should declare and/or malloc rotations as standard C structs. Access the components of the vector as though it is a simple structure or use the access and operation functions described in this reference page: /* This is defined in Inventor_c/SbLinear.h: */ struct SbRotation { float quat[4]; }; typedef SbRotation SbRot /* This is what your code should look like: */ SbRot r1, r2; /* The next two lines produce equivalent rotations. */ r1.quat[0] = 1.0; r1.quat[1] = r1.quat[2] = 0.0; r1.quat[3] = 1.0; SbRotSetQ_U_A_T( v2, 1.0, 0.0, 0.0, 1.0 ); FUNCTIONS void SbRotGetAxisAngle(const SbRot *this, SbVec3f *axis, float *radians) Returns corresponding 3D rotation axis vector and angle in radians. void SbRotGetMx(const SbRot *this, SbMatrix *matrix) Returns corresponding 4x4 rotation matrix. SbRotation * SbRotInvert(SbRot *this) Changes a rotation to be its inverse. SbRotation SbRotInverse(const SbRot *this) Returns the inverse of a rotation. SbRotation * SbRotSetMx(SbRot *this, const SbMatrix *m) Sets value of rotation from a rotation matrix. SbRotation * SbRotSetAxisAngle(SbRot *this, const SbVec3f *axis, float radians) Sets value of vector from 3D rotation axis vector and angle in radians. SbRotation * SbRotSetFromTo(SbRot *this, const SbVec3f *rotateFrom, const SbVec3f *rotateTo) Sets rotation to rotate one direction vector to another. The rotateFrom and rotateTo arguments are normalized before the rotation is calculated. int SbRotIsEq(SbRot *this, const SbRotation *q1, const SbRotation *q2) int SbRotIsNEq(SbRot *this, const SbRotation *q1, const SbRotation *q2) Equality comparison operators. SbBool SbRotEquals(const SbRot *this, const SbRotation *r, float tolerance) Equality comparison within given tolerance - the square of the length of the maximum distance between the two quaternion vectors. SbRotation SbRotMult(SbRot *this, const SbRotation *q1, const SbRotation *q2) Multiplication of two rotations; results in product of rotations. void SbRotMultVec(const SbRot *this, const SbVec3f *src, SbVec3f *dst) Multiplies the given vector by the matrix of this rotation. void SbRotScaleAngle(SbRot *this, float scaleFactor ) Keep the axis the same. Multiply the angle of rotation by the amount scaleFactor. SbRotation SbRotSlerp(const SbRotation *rot0, const SbRotation *rot1, float t) Spherical linear interpolation: as t goes from 0 to 1, returned value goes from rot0 to rot1. SbRotation SbRotIdent() Returns a null rotation. MACROS SbRotGetQuat(float *dest, SbRotation *src) SbRotGetQ_U_A_T(float q0, float q1, float q2, float q3, SbRotation *src) SbRotSetQuat(SbRotation *dest, float *src) SbRotSetQ_U_A_T(SbRotation *dest, float q0, float q1, float q2, float q3) Sets and gets rotations in the form of quaternions. The quaternion may be passed either as an array of length 4 or as 4 separate components. FILE FORMAT/DEFAULTS Rotation { } NOTES Rotations are stored internally as quaternions. SEE ALSO SbVec3f, SbMatrix