Open Inventor Reference
SbRotation Class Reference

Class for representing a rotation. More...

#include <Inventor/SbLinear.h>

Public Member Functions

 SbRotation ()
 Default constructor, initialized to identity.
 
 SbRotation (const float v[4])
 
 SbRotation (float q0, float q1, float q2, float q3)
 
 SbRotation (const SbMatrix &m)
 
 SbRotation (const SbVec3f &axis, float radians)
 
 SbRotation (const SbVec3f &rotateFrom, const SbVec3f &rotateTo)
 Constructors for rotation.
 
const float * getValue () const
 Returns pointer to array of 4 components defining quaternion.
 
void getValue (float &q0, float &q1, float &q2, float &q3) const
 Returns 4 individual components of rotation quaternion.
 
void getValue (SbVec3f &axis, float &radians) const
 Returns corresponding 3D rotation axis vector and angle in radians.
 
void getValue (SbMatrix &matrix) const
 Returns corresponding 4x4 rotation matrix.
 
SbMatrix getMatrix () const
 Returns corresponding 4x4 rotation matrix.
 
SbVec3f getAxis () const
 Returns corresponding 3D rotation axis vector.
 
float getAngle () const
 Returns corresponding angle in radians.
 
SbRotationinvert ()
 Changes a rotation to be its inverse.
 
SbRotation inverse () const
 Returns the inverse of a rotation.
 
SbRotationsetValue (const float q[4])
 Sets value of rotation from array of 4 components of a quaternion.
 
SbRotationsetValue (float q0, float q1, float q2, float q3)
 Sets value of rotation from 4 individual components of a quaternion.
 
SbRotationsetValue (const SbMatrix &m)
 Sets value of rotation from a rotation matrix.
 
SbRotationsetValue (const SbVec3f &axis, float radians)
 Sets value of vector from 3D rotation axis vector and angle in radians.
 
SbRotationsetValue (const SbVec3f &rotateFrom, const SbVec3f &rotateTo)
 Sets rotation to rotate one direction vector to another.
 
SbRotationoperator*= (const SbRotation &q)
 Multiplies by another rotation; results in product of rotations.
 
bool equals (const SbRotation &r, float tolerance) const
 Equality comparison within given tolerance em the square of the length of the maximum distance between the two quaternion vectors.
 
void multVec (const SbVec3f &src, SbVec3f &dst) const
 Multiplies the given vector by the matrix of this rotation.
 
SbVec3f transformPoint (const SbVec3f &src) const
 Multiplies the given vector by the matrix of this rotation.
 
void scaleAngle (float scaleFactor)
 Keep the axis the same.
 

Static Public Member Functions

static SbRotation 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.
 
static SbRotation identity ()
 Returns a null rotation.
 

Friends

INVENTOR_API bool operator== (const SbRotation &q1, const SbRotation &q2)
 Equality comparison operator.
 
INVENTOR_API bool operator!= (const SbRotation &q1, const SbRotation &q2)
 
INVENTOR_API SbRotation operator* (const SbRotation &q1, const SbRotation &q2)
 Multiplication of two rotations; results in product of rotations.
 

Detailed 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. {}

NOTES

Rotations are stored internally as quaternions.

See Also
SbVec3f, SbMatrix

Definition at line 678 of file SbLinear.h.

Constructor & Destructor Documentation

◆ SbRotation() [1/6]

SbRotation::SbRotation ( )
inline

Definition at line 682 of file SbLinear.h.

◆ SbRotation() [2/6]

SbRotation::SbRotation ( const float  v[4])
inline

◆ SbRotation() [3/6]

SbRotation::SbRotation ( float  q0,
float  q1,
float  q2,
float  q3 
)
inline

◆ SbRotation() [4/6]

SbRotation::SbRotation ( const SbMatrix m)
inline

◆ SbRotation() [5/6]

SbRotation::SbRotation ( const SbVec3f axis,
float  radians 
)
inline

◆ SbRotation() [6/6]

SbRotation::SbRotation ( const SbVec3f rotateFrom,
const SbVec3f rotateTo 
)
inline

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.

Definition at line 710 of file SbLinear.h.

Member Function Documentation

◆ equals()

bool SbRotation::equals ( const SbRotation r,
float  tolerance 
) const

◆ getAngle()

float SbRotation::getAngle ( ) const
inline

Definition at line 733 of file SbLinear.h.

◆ getAxis()

SbVec3f SbRotation::getAxis ( ) const
inline

Definition at line 731 of file SbLinear.h.

◆ getMatrix()

SbMatrix SbRotation::getMatrix ( ) const

◆ getValue() [1/4]

const float * SbRotation::getValue ( ) const
inline

Definition at line 714 of file SbLinear.h.

◆ getValue() [2/4]

void SbRotation::getValue ( float &  q0,
float &  q1,
float &  q2,
float &  q3 
) const

◆ getValue() [3/4]

void SbRotation::getValue ( SbMatrix matrix) const

◆ getValue() [4/4]

void SbRotation::getValue ( SbVec3f axis,
float &  radians 
) const

◆ identity()

static SbRotation SbRotation::identity ( )
inlinestatic

Definition at line 788 of file SbLinear.h.

◆ inverse()

SbRotation SbRotation::inverse ( ) const
inline

Definition at line 739 of file SbLinear.h.

References invert().

◆ invert()

SbRotation & SbRotation::invert ( )

Referenced by inverse().

◆ multVec()

void SbRotation::multVec ( const SbVec3f src,
SbVec3f dst 
) const

◆ operator*=()

SbRotation & SbRotation::operator*= ( const SbRotation q)

◆ scaleAngle()

void SbRotation::scaleAngle ( float  scaleFactor)

Multiply the angle of rotation by the amount scaleFactor.

◆ setValue() [1/5]

SbRotation & SbRotation::setValue ( const float  q[4])

◆ setValue() [2/5]

SbRotation & SbRotation::setValue ( const SbMatrix m)

◆ setValue() [3/5]

SbRotation & SbRotation::setValue ( const SbVec3f axis,
float  radians 
)

◆ setValue() [4/5]

SbRotation & SbRotation::setValue ( const SbVec3f rotateFrom,
const SbVec3f rotateTo 
)

◆ setValue() [5/5]

SbRotation & SbRotation::setValue ( float  q0,
float  q1,
float  q2,
float  q3 
)

◆ slerp()

static SbRotation SbRotation::slerp ( const SbRotation rot0,
const SbRotation rot1,
float  t 
)
static

◆ transformPoint()

SbVec3f SbRotation::transformPoint ( const SbVec3f src) const
inline

Definition at line 776 of file SbLinear.h.

Friends And Related Symbol Documentation

◆ operator!=

INVENTOR_API bool operator!= ( const SbRotation q1,
const SbRotation q2 
)
friend

Definition at line 802 of file SbLinear.h.

◆ operator*

INVENTOR_API SbRotation operator* ( const SbRotation q1,
const SbRotation q2 
)
friend

◆ operator==

INVENTOR_API bool operator== ( const SbRotation q1,
const SbRotation q2 
)
friend

The documentation for this class was generated from the following file: