SbRotation Class Reference
[Base classes]

The SbRotation class represents a rotation in 3D space. More...

#include <Inventor/SbLinear.h>

List of all members.

Public Member Functions

 SbRotation (void)
 SbRotation (const SbVec3f &axis, const float radians)
 SbRotation (const float q[4])
 SbRotation (const float q0, const float q1, const float q2, const float q3)
 SbRotation (const SbMatrix &m)
 SbRotation (const SbVec3f &rotateFrom, const SbVec3f &rotateTo)
const float * getValue (void) const
void getValue (float &q0, float &q1, float &q2, float &q3) const
SbRotationsetValue (const float q0, const float q1, const float q2, const float q3)
void getValue (SbVec3f &axis, float &radians) const
void getValue (SbMatrix &matrix) const
SbRotationinvert (void)
SbRotation inverse (void) const
SbRotationsetValue (const float q[4])
SbRotationsetValue (const SbMatrix &m)
SbRotationsetValue (const SbVec3f &axis, const float radians)
SbRotationsetValue (const SbVec3f &rotateFrom, const SbVec3f &rotateTo)
SbRotationoperator *= (const SbRotation &q)
SbRotationoperator *= (const float s)
SbBool equals (const SbRotation &r, const float tolerance) const
void multVec (const SbVec3f &src, SbVec3f &dst) const
void scaleAngle (const float scaleFactor)
void print (FILE *fp) const

Static Public Member Functions

static SbRotation slerp (const SbRotation &rot0, const SbRotation &rot1, float t)
static SbRotation identity (void)

Friends

int operator== (const SbRotation &q1, const SbRotation &q2)
int operator!= (const SbRotation &q1, const SbRotation &q2)
SbRotation operator * (const SbRotation &q1, const SbRotation &q2)


Detailed Description

The SbRotation class represents a rotation in 3D space.

SbRotation is used extensively throughout the Coin library.

An SbRotation is stored internally as a quaternion for speed and storage reasons, but inquiries can be done to get and set axis and angle values for convenience.

See also:
SbMatrix

Constructor & Destructor Documentation

SbRotation::SbRotation ( void   ) 

The default constructor just initializes a valid rotation. The actual value is unspecified, and you should not depend on it.

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

Construct a new SbRotation object initialized with the given axis-of-rotation and rotation angle.

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

Construct a new SbRotation object initialized with the given quaternion components.

The array must be ordered as follows:

q[0] = x, q[1] = y, q[2] = z and q[3] = w, where the quaternion is specified by q=w+xi+yj+zk.

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

Construct a new SbRotation object initialized with the given quaternion components.

SbRotation::SbRotation ( const SbMatrix m  ) 

Construct a new SbRotation object initialized with the given rotation matrix.

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

Construct a rotation which is the minimum rotation necessary to make vector rotateFrom point in the direction of vector rotateTo.


Member Function Documentation

const float * SbRotation::getValue ( void   )  const

Return pointer to an array with the rotation expressed as four quaternion values.

See also:
setValue().

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

Return the four quaternion components representing the rotation.

See also:
setValue().

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

Set the rotation.

See also:
getValue().

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

Return the rotation in the form of an axis-of-rotation and a rotation angle.

See also:
setValue().

void SbRotation::getValue ( SbMatrix matrix  )  const

Return this rotation in the form of a matrix.

See also:
setValue().

SbRotation & SbRotation::invert ( void   ) 

Invert the rotation. Returns reference to self.

See also:
inverse()

SbRotation SbRotation::inverse ( void   )  const

Non-destructively inverses the rotation and returns the result.

See also:
invert()

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

Reset the rotation by the four quaternions in the array.

See also:
getValue().

SbRotation & SbRotation::setValue ( const SbMatrix m  ) 

Set the rotation from the components of the given matrix. Returns reference to self.

See also:
getValue().

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

Reset rotation with the given axis-of-rotation and rotation angle. Returns reference to self.

Make sure axis is not the null vector when calling this method.

See also:
getValue().

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

Construct a rotation which is the minimum rotation necessary to make vector rotateFrom point in the direction of vector rotateTo.

Returns reference to self.

See also:
getValue().

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

Multiplies the quaternions.

Note that order is important when combining quaternions with the multiplication operator.

SbRotation & SbRotation::operator *= ( const float  s  ) 

Multiplies components of quaternion with scalar value s. Returns reference to self.

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

Check the internal quaternion representation vectors for equality within the given tolerance.

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

Rotate the src vector and put the result in dst.

void SbRotation::scaleAngle ( const float  scaleFactor  ) 

Scale the angle of rotation by scaleFactor.

SbRotation slerp ( const SbRotation rot0,
const SbRotation rot1,
float  t 
) [static]

Interpolates along the shortest path between the two rotation positions (from rot0 to rot1).

Returns the SbRotation which will rotate rot0 the given part t of the spherical distance towards rot1, where t=0 will yield rot0 and t=1 will yield rot1.

t should be in the interval [0, 1].

SbRotation SbRotation::identity ( void   )  [static]

Returns an identity rotation.

void SbRotation::print ( FILE *  fp  )  const

Dump the state of this object to the fp file stream. Only works in debug version of library, method does nothing in an optimized compile.


Friends And Related Function Documentation

int operator== ( const SbRotation q1,
const SbRotation q2 
) [friend]

Check if the two rotations are equal.

See also:
equals().

int operator!= ( const SbRotation q1,
const SbRotation q2 
) [friend]

Check if the two rotations are unequal.

See also:
equals().

SbRotation operator * ( const SbRotation q1,
const SbRotation q2 
) [friend]

Multiplies the two rotations and returns the result.

Note that order is important when combining quaternions with the multiplication operator.


The documentation for this class was generated from the following files:
Generated on Sun Sep 23 00:19:07 2007 for Coin by  doxygen 1.5.3