Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SbDPRotation Class Reference

The SbDPRotation class represents a rotation in 3D space using double precision data. More...

#include <Inventor/SbDPRotation.h>

Public Member Functions

 SbDPRotation (const double q0, const double q1, const double q2, const double q3)
 
 SbDPRotation (const double q[4])
 
 SbDPRotation (const SbDPMatrix &m)
 
 SbDPRotation (const SbVec3d &axis, const double radians)
 
 SbDPRotation (const SbVec3d &rotateFrom, const SbVec3d &rotateTo)
 
 SbDPRotation (void)
 
SbBool equals (const SbDPRotation &r, double tolerance) const
 
void getValue (double &q0, double &q1, double &q2, double &q3) const
 
void getValue (SbDPMatrix &matrix) const
 
void getValue (SbVec3d &axis, double &radians) const
 
const double * getValue (void) const
 
SbDPRotation inverse (void) const
 
SbDPRotationinvert (void)
 
void multVec (const SbVec3d &src, SbVec3d &dst) const
 
SbDPRotationoperator*= (const double s)
 
SbDPRotationoperator*= (const SbDPRotation &q)
 
void print (FILE *fp) const
 
void scaleAngle (const double scaleFactor)
 
SbDPRotationsetValue (const double q0, const double q1, const double q2, const double q3)
 
SbDPRotationsetValue (const double q[4])
 
SbDPRotationsetValue (const SbDPMatrix &m)
 
SbDPRotationsetValue (const SbVec3d &axis, const double radians)
 
SbDPRotationsetValue (const SbVec3d &rotateFrom, const SbVec3d &rotateTo)
 

Static Public Member Functions

static SbDPRotation identity (void)
 
static SbDPRotation slerp (const SbDPRotation &rot0, const SbDPRotation &rot1, double t)
 

Related Symbols

(Note that these are not member symbols.)

int operator!= (const SbDPRotation &q1, const SbDPRotation &q2)
 
SbDPRotation operator* (const SbDPRotation &q1, const SbDPRotation &q2)
 
int operator== (const SbDPRotation &q1, const SbDPRotation &q2)
 
SbDPRotation slerp (const SbDPRotation &rot0, const SbDPRotation &rot1, double t)
 

Detailed Description

The SbDPRotation class represents a rotation in 3D space using double precision data.

SbDPRotation is used extensively throughout the Coin library.

An SbDPRotation 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
SbDPMatrix

Constructor & Destructor Documentation

◆ SbDPRotation() [1/6]

SbDPRotation::SbDPRotation ( void )

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

◆ SbDPRotation() [2/6]

SbDPRotation::SbDPRotation ( const SbVec3d & axis,
const double radians )

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

◆ SbDPRotation() [3/6]

SbDPRotation::SbDPRotation ( const double q[4])

Construct a new SbDPRotation 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.

◆ SbDPRotation() [4/6]

SbDPRotation::SbDPRotation ( const double q0,
const double q1,
const double q2,
const double q3 )

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

◆ SbDPRotation() [5/6]

SbDPRotation::SbDPRotation ( const SbDPMatrix & m)

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

◆ SbDPRotation() [6/6]

SbDPRotation::SbDPRotation ( const SbVec3d & rotateFrom,
const SbVec3d & rotateTo )

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

Member Function Documentation

◆ equals()

SbBool SbDPRotation::equals ( const SbDPRotation & r,
double tolerance ) const

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

◆ getValue() [1/4]

void SbDPRotation::getValue ( double & q0,
double & q1,
double & q2,
double & q3 ) const

Return the four quaternion components representing the rotation.

See also
setValue().

◆ getValue() [2/4]

void SbDPRotation::getValue ( SbDPMatrix & matrix) const

Return this rotation in the form of a matrix.

See also
setValue().

◆ getValue() [3/4]

void SbDPRotation::getValue ( SbVec3d & axis,
double & radians ) const

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

See also
setValue().

◆ getValue() [4/4]

const double * SbDPRotation::getValue ( void ) const

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

See also
setValue().

◆ identity()

SbDPRotation SbDPRotation::identity ( void )
static

Returns an identity rotation.

◆ inverse()

SbDPRotation SbDPRotation::inverse ( void ) const

Non-destructively inverses the rotation and returns the result.

See also
invert()

◆ invert()

SbDPRotation & SbDPRotation::invert ( void )

Invert the rotation. Returns reference to self.

See also
inverse()

◆ multVec()

void SbDPRotation::multVec ( const SbVec3d & src,
SbVec3d & dst ) const

Rotate the src vector and put the result in dst.

◆ operator*=() [1/2]

SbDPRotation & SbDPRotation::operator*= ( const double s)

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

◆ operator*=() [2/2]

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

Multiplies the quaternions.

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

◆ print()

void SbDPRotation::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 build.

◆ scaleAngle()

void SbDPRotation::scaleAngle ( const double scaleFactor)

Scale the angle of rotation by scaleFactor.

◆ setValue() [1/5]

SbDPRotation & SbDPRotation::setValue ( const double q0,
const double q1,
const double q2,
const double q3 )

Set the rotation.

See also
getValue().

◆ setValue() [2/5]

SbDPRotation & SbDPRotation::setValue ( const double q[4])

Reset the rotation by the four quaternions in the array.

See also
getValue().

◆ setValue() [3/5]

SbDPRotation & SbDPRotation::setValue ( const SbDPMatrix & m)

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

See also
getValue().

◆ setValue() [4/5]

SbDPRotation & SbDPRotation::setValue ( const SbVec3d & axis,
const double 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().

◆ setValue() [5/5]

SbDPRotation & SbDPRotation::setValue ( const SbVec3d & rotateFrom,
const SbVec3d & 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().

◆ slerp()

SbDPRotation slerp ( const SbDPRotation & rot0,
const SbDPRotation & rot1,
double t )
static

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

Returns the SbDPRotation 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].

Friends And Related Symbol Documentation

◆ operator!=()

int operator!= ( const SbDPRotation & q1,
const SbDPRotation & q2 )
related

Check if the two rotations are not equal.

See also
equals().

◆ operator*()

Multiplies the two rotations and returns the result.

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

◆ operator==()

int operator== ( const SbDPRotation & q1,
const SbDPRotation & q2 )
related

Check if the two rotations are equal.

See also
equals().

◆ slerp()

SbDPRotation slerp ( const SbDPRotation & rot0,
const SbDPRotation & rot1,
double t )
related

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

Returns the SbDPRotation 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].


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