Isis Developer Reference
|
Provide operations for quaternion arithmetic. More...
#include <Quaternion.h>
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. | |
Quaternion & | operator= (const Quaternion &quat) |
Assign value of quaternion class to another quaternion. | |
Quaternion & | operator*= (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. | |
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.
Isis::Quaternion::Quaternion | ( | ) |
Constructs an empty quaternion.
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.
rotation | rotation defined as either a matrix or another quaternion loaded as a vector |
References Set().
Isis::Quaternion::~Quaternion | ( | ) |
Destroys the Quaternion object.
Quaternion Isis::Quaternion::Conjugate | ( | ) |
Returns the conjugate of the quaternion.
|
inline |
Return the quaternion as a vector.
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,
[in] | scalar | (const double &) scalar value to be multiplied times the current quaternion |
References _FILEINFO_, and Isis::IException::Programmer.
Quaternion Isis::Quaternion::operator* | ( | const Quaternion & | quat | ) | const |
Multiply two Naif quaternions to create a new quaternion.
For example,
More information is available on quaternions and the multiplication algorithm in the Naif routine qxq_c.c
[in] | quat | (const Quaternion &) quaternion to multiply on the right |
Quaternion & Isis::Quaternion::operator*= | ( | const Quaternion & | quat | ) |
Multiply current Naif quaternion by another Naif quaternion, replacing the current quaternion.
For example,
More information on quaternions and the multiplication algorithm is available in the Naif routine qxq_c.
[in] | quat | (const Quaternion &) quaternion to multiply on the right |
Quaternion & Isis::Quaternion::operator= | ( | const Quaternion & | quat | ) |
Assign value of quaternion class to another quaternion.
For example,
quat | The Quaternion to copy |
|
inline |
Return a member of a quaternion.
For example,
[in] | index | (const int &) quaternion member to return |
std::vector< double > Isis::Quaternion::Qxv | ( | const std::vector< double > & | vin | ) |
Multiply a vector by a quaternion (rotate the vector)
[in] | vin | (const std::vector<double>(3)) Vector to be multiplied (rotated) |
References _FILEINFO_, and Isis::IException::Programmer.
void Isis::Quaternion::Set | ( | std::vector< double > | rotation | ) |
Sets the quaternion value.
rotation | rotation defined as either a matrix or a set of 3 angles |
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), and Isis::IException::Programmer.
Referenced by Quaternion().
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().
std::vector< double > Isis::Quaternion::ToMatrix | ( | ) |
Converts quaternion to 3x3 rotational matrix.
Referenced by ToAngles().