Isis Developer Reference
Isis::Quaternion Class Reference

Provide operations for quaternion arithmetic. More...

#include <Quaternion.h>

Collaboration diagram for Isis::Quaternion:
Collaboration graph

Public Member Functions

 Quaternion ()
 Constructs an empty quaternion.
 
 Quaternion (const std::vector< double > matrix)
 Construct a Quaternion class from a matrix stored as a vector < double > with 9 elements or from a quaternion stored as a vector < double > with 4 elements.
 
 ~Quaternion ()
 Destroys the Quaternion object.
 
std::vector< double > ToMatrix ()
 Converts quaternion to 3x3 rotational matrix.
 
std::vector< double > ToAngles (int axis3, int axis2, int axis1)
 Return the camera angles (right ascension, declination, and twist) for the quaternion.
 
void Set (std::vector< double >)
 Sets the quaternion value.
 
std::vector< double > GetQuaternion () const
 Return the quaternion as a vector.
 
Quaternionoperator= (const Quaternion &quat)
 Assign value of quaternion class to another quaternion.
 
Quaternionoperator*= (const Quaternion &quat)
 Multiply current Naif quaternion by another Naif quaternion, replacing the current quaternion.
 
Quaternion operator* (const Quaternion &quat) const
 Multiply two Naif quaternions to create a new quaternion.
 
Quaternion operator* (const double &scalar)
 Multiply a quaternion by a scalar.
 
double & operator[] (int index)
 Return a member of a quaternion.
 
std::vector< double > Qxv (const std::vector< double > &vin)
 Multiply a vector by a quaternion (rotate the vector)
 
Quaternion Conjugate ()
 Returns the conjugate of the quaternion.
 

Detailed Description

Provide operations for quaternion arithmetic.

This class provides a wrapper for existing Naif quaternion functions and also includes other operators and methods useful for working with quaternions.

Author
2005-12-07 Debbie A. Cook

Constructor & Destructor Documentation

◆ Quaternion() [1/2]

Isis::Quaternion::Quaternion ( )

Constructs an empty quaternion.

◆ Quaternion() [2/2]

Isis::Quaternion::Quaternion ( const std::vector< double > rotation)

Construct a Quaternion class from a matrix stored as a vector < double > with 9 elements or from a quaternion stored as a vector < double > with 4 elements.

Parameters
rotationrotation defined as either a matrix or another quaternion loaded as a vector

References Set().

◆ ~Quaternion()

Isis::Quaternion::~Quaternion ( )

Destroys the Quaternion object.

Member Function Documentation

◆ Conjugate()

Quaternion Isis::Quaternion::Conjugate ( )

Returns the conjugate of the quaternion.

◆ GetQuaternion()

std::vector< double > Isis::Quaternion::GetQuaternion ( ) const
inline

Return the quaternion as a vector.

◆ operator*() [1/2]

Quaternion Isis::Quaternion::operator* ( const double & scalar)

Multiply a quaternion by a scalar.

Just multiply the rotation part and polish the resulting quaternion so it is still a unit quaternion with positive rotation. For example,

Quaternion q1(),q(2);
double scalar
...
q2() = scalar*q2;
Provide operations for quaternion arithmetic.
Definition Quaternion.h:36
Parameters
[in]scalar(const double &) scalar value to be multiplied times the current quaternion
Returns
(Quaternion) product of scalar and quaternion

References _FILEINFO_, and Isis::IException::Programmer.

◆ operator*() [2/2]

Quaternion Isis::Quaternion::operator* ( const Quaternion & quat) const

Multiply two Naif quaternions to create a new quaternion.

For example,

Quaternion q1(),q(2);
...
Quaternion q3() = q1*q2;

More information is available on quaternions and the multiplication algorithm in the Naif routine qxq_c.c

Parameters
[in]quat(const Quaternion &) quaternion to multiply on the right
Returns
(Quaternion) product of quaternions

◆ operator*=()

Quaternion & Isis::Quaternion::operator*= ( const Quaternion & quat)

Multiply current Naif quaternion by another Naif quaternion, replacing the current quaternion.

For example,

Quaternion q1(),q(2);
...
Quaternion q2() *= q1;

More information on quaternions and the multiplication algorithm is available in the Naif routine qxq_c.

Parameters
[in]quat(const Quaternion &) quaternion to multiply on the right
Returns
(Quaternion) product of quaternions

◆ operator=()

Quaternion & Isis::Quaternion::operator= ( const Quaternion & quat)

Assign value of quaternion class to another quaternion.

For example,

Quaternion q1( matrix );
...
q2 = q1;
Parameters
quatThe Quaternion to copy

◆ operator[]()

double & Isis::Quaternion::operator[] ( int index)
inline

Return a member of a quaternion.

For example,

...
double angle = q[0];
Parameters
[in]index(const int &) quaternion member to return
Returns
(double&) value pointed to by iter

◆ Qxv()

std::vector< double > Isis::Quaternion::Qxv ( const std::vector< double > & vin)

Multiply a vector by a quaternion (rotate the vector)

Parameters
[in]vin(const std::vector<double>(3)) Vector to be multiplied (rotated)

References _FILEINFO_, and Isis::IException::Programmer.

◆ Set()

void Isis::Quaternion::Set ( std::vector< double > rotation)

Sets the quaternion value.

Parameters
rotationrotation defined as either a matrix or a set of 3 angles

References _FILEINFO_, Isis::NaifStatus::CheckErrors(), and Isis::IException::Programmer.

Referenced by Quaternion().

◆ ToAngles()

std::vector< double > Isis::Quaternion::ToAngles ( int axis3,
int axis2,
int axis1 )

Return the camera angles (right ascension, declination, and twist) for the quaternion.

References Isis::NaifStatus::CheckErrors(), and ToMatrix().

◆ ToMatrix()

std::vector< double > Isis::Quaternion::ToMatrix ( )

Converts quaternion to 3x3 rotational matrix.

Referenced by ToAngles().


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