Isis 3 Programmer Reference
|
Provide operations for quaternion arithmetic. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Constructs an empty quaternion. More... | |
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. More... | |
~Quaternion () | |
Destroys the Quaternion object. More... | |
std::vector< double > | ToMatrix () |
Converts quaternion to 3x3 rotational matrix. More... | |
std::vector< double > | ToAngles (int axis3, int axis2, int axis1) |
Return the camera angles (right ascension, declination, and twist) for the quaternion. More... | |
void | Set (std::vector< double >) |
Sets the quaternion value. More... | |
std::vector< double > | GetQuaternion () const |
Return the quaternion as a vector. More... | |
Quaternion & | operator= (const Quaternion &quat) |
Assign value of quaternion class to another quaternion. More... | |
Quaternion & | operator*= (const Quaternion &quat) |
Multiply current Naif quaternion by another Naif quaternion, replacing the current quaternion. More... | |
Quaternion | operator* (const Quaternion &quat) const |
Multiply two Naif quaternions to create a new quaternion. More... | |
Quaternion | operator* (const double &scalar) |
Multiply a quaternion by a scalar. More... | |
double & | operator[] (int index) |
Return a member of a quaternion. More... | |
std::vector< double > | Qxv (const std::vector< double > &vin) |
Multiply a vector by a quaternion (rotate the vector) More... | |
Quaternion | Conjugate () |
Returns the conjugate of the quaternion. More... | |
Private Member Functions | |
void | Polish (Quaternion &quat) |
Polish the quaternion – make the first component positive. More... | |
Private Attributes | |
std::vector< double > | p_quaternion |
Quaternion. More... | |
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.
????-??-?? Steven Lambright Fixed documentation
2015-07-21 Kristin Berry - Added NaifStatus::CheckErrors() to see if any NAIF errors were signaled. References #2248.
Definition at line 52 of file Quaternion.h.
Isis::Quaternion::Quaternion | ( | ) |
Constructs an empty quaternion.
Definition at line 42 of file Quaternion.cpp.
References p_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 |
Definition at line 58 of file Quaternion.cpp.
References p_quaternion, and Set().
Isis::Quaternion::~Quaternion | ( | ) |
Destroys the Quaternion object.
Definition at line 65 of file Quaternion.cpp.
Quaternion Isis::Quaternion::Conjugate | ( | ) |
Returns the conjugate of the quaternion.
Definition at line 213 of file Quaternion.cpp.
References p_quaternion.
Referenced by Qxv().
|
inline |
Return the quaternion as a vector.
Definition at line 70 of file Quaternion.h.
References p_quaternion.
Referenced by Isis::SpiceRotation::Cache().
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 |
Definition at line 163 of file Quaternion.cpp.
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 |
Definition at line 188 of file Quaternion.cpp.
References _FILEINFO_, p_quaternion, Polish(), and Isis::IException::Programmer.
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 |
Definition at line 133 of file Quaternion.cpp.
References p_quaternion.
Quaternion & Isis::Quaternion::operator= | ( | const Quaternion & | quat | ) |
Assign value of quaternion class to another quaternion.
For example,
quat | The Quaternion to copy |
Definition at line 111 of file Quaternion.cpp.
References p_quaternion.
|
inline |
Return a member of a quaternion.
For example,
[in] | index | (const int &) quaternion member to return |
Definition at line 95 of file Quaternion.h.
References p_quaternion.
|
private |
Polish the quaternion – make the first component positive.
Definition at line 258 of file Quaternion.cpp.
References p_quaternion.
Referenced by operator*().
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) |
Definition at line 231 of file Quaternion.cpp.
References _FILEINFO_, Conjugate(), p_quaternion, 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 |
Definition at line 72 of file Quaternion.cpp.
References _FILEINFO_, Isis::NaifStatus::CheckErrors(), p_quaternion, 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.
Definition at line 276 of file Quaternion.cpp.
References Isis::NaifStatus::CheckErrors(), and ToMatrix().
std::vector< double > Isis::Quaternion::ToMatrix | ( | ) |
Converts quaternion to 3x3 rotational matrix.
Definition at line 91 of file Quaternion.cpp.
References p_quaternion.
Referenced by ToAngles().
|
private |
Definition at line 109 of file Quaternion.h.
Referenced by Conjugate(), GetQuaternion(), operator*(), operator*=(), operator=(), operator[](), Polish(), Quaternion(), Qxv(), Set(), and ToMatrix().