man SbRotation () - class for representing a rotation

NAME

SbRotation - class for representing a rotation

INHERITS FROM

SbRotation

SYNOPSIS

#include <Inventor/SbLinear.h> Methods from class SbRotation: c } c } SbRotation()

c } c } SbRotation(const SbVec3f &axis, float radians)

c } c } SbRotation(const float v[4])

c } c } SbRotation(float q0, float q1, float q2, float q3)

c } c } SbRotation(const SbMatrix &m)

c } c } SbRotation(const SbVec3f &rotateFrom, const SbVec3f &rotateTo)

c } c } getValue() const

c } c } getValue(float &q0, float &q1, float &q2, float &q3) const

c } c } setValue(float q0, float q1, float q2, float q3)

c } c } getValue(SbVec3f &axis, float &radians) const

c } c } getValue(SbMatrix &matrix) const

c } c } invert()

c } c } inverse() const

c } c } setValue(const float q[4])

c } c } setValue(const SbMatrix &m)

c } c } setValue(const SbVec3f &axis, float radians)

c } c } setValue(const SbVec3f &rotateFrom, const SbVec3f &rotateTo)

c } c } operator *=(const SbRotation &q)

c } c } operator ==(const SbRotation &q1, const SbRotation &q2)

c } c } operator !=(const SbRotation &q1, const SbRotation &q2)

c } c } equals(const SbRotation &r, float tolerance) const

c } c } operator *(const SbRotation &q1, const SbRotation &q2)

c } c } multVec(const SbVec3f &src, SbVec3f &dst) const

c } c } scaleAngle(float scaleFactor )

c } c } slerp(const SbRotation &rot0, const SbRotation &rot1, float t)

c } c } identity()

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.

METHODS

c } c } SbRotation()

c } c } SbRotation(const SbVec3f &axis, float radians)

c } c } SbRotation(const float v[4])

c } c } SbRotation(float q0, float q1, float q2, float q3)

c } c } SbRotation(const SbMatrix &m)

c } c } SbRotation(const SbVec3f &rotateFrom, const SbVec3f &rotateTo)

Constructors 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 rotateFrom and rotateTo vectors are normalized by the constructor before calculating the rotation. c } c } getValue() const

Returns pointer to array of 4 components defining quaternion. c } c } getValue(float &q0, float &q1, float &q2, float &q3) const

Returns 4 individual components of rotation quaternion. c } c } setValue(float q0, float q1, float q2, float q3)

Sets value of rotation from 4 individual components of a quaternion. c } c } getValue(SbVec3f &axis, float &radians) const

Returns corresponding 3D rotation axis vector and angle in radians. c } c } getValue(SbMatrix &matrix) const

Returns corresponding 4x4 rotation matrix. c } c } invert()

Changes a rotation to be its inverse. c } c } inverse() const

Returns the inverse of a rotation. c } c } setValue(const float q[4])

Sets value of rotation from array of 4 components of a quaternion. c } c } setValue(const SbMatrix &m)

Sets value of rotation from a rotation matrix. c } c } setValue(const SbVec3f &axis, float radians)

Sets value of vector from 3D rotation axis vector and angle in radians. c } c } setValue(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. c } c } operator *=(const SbRotation &q)

Multiplies by another rotation; results in product of rotations. c } c } operator ==(const SbRotation &q1, const SbRotation &q2)

c } c } operator !=(const SbRotation &q1, const SbRotation &q2)

Equality comparison operators. c } c } equals(const SbRotation &r, float tolerance) const

Equality comparison within given tolerance - the square of the length of the maximum distance between the two quaternion vectors. c } c } operator *(const SbRotation &q1, const SbRotation &q2)

Multiplication of two rotations; results in product of rotations. c } c } multVec(const SbVec3f &src, SbVec3f &dst) const

Multiplies the given vector by the matrix of this rotation. c } c } scaleAngle(float scaleFactor )

Keep the axis the same. Multiply the angle of rotation by the amount scaleFactor. c } c } slerp(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. c } c } identity()

Returns a null rotation.

NOTES

Rotations are stored internally as quaternions.

SEE ALSO

SbVec3f, SbMatrix