Isis Developer Reference
Quaternion.h
Go to the documentation of this file.
1#ifndef Quaternion_h
2#define Quaternion_h
3
9/* SPDX-License-Identifier: CC0-1.0 */
10
11#include <string>
12#include <vector>
13
14#include <SpiceUsr.h>
15#include <SpiceZfc.h>
16#include <SpiceZmc.h>
17
18namespace Isis {
36 class Quaternion {
37 public:
38 // constructors
39 Quaternion();
40 Quaternion(const std::vector<double> matrix);
41
42 // destructor
44
45 //Methods
46
47 std::vector<double> ToMatrix();
48
49 std::vector<double> ToAngles(int axis3, int axis2, int axis1);
50
51 void Set(std::vector<double>);
52
54 std::vector<double> GetQuaternion() const {
55 return p_quaternion;
56 }
57 ;
58 Quaternion &operator=(const Quaternion &quat);
59
60 Quaternion &operator*=(const Quaternion &quat);
61
62 Quaternion operator*(const Quaternion &quat) const;
63
64 Quaternion operator*(const double &scalar);
65
79 double &operator[](int index) {
80 return p_quaternion.at(index);
81 };
82
83
84
85 std::vector<double> Qxv(const std::vector<double> &vin);
86
88
89
90
91
92 private:
93 std::vector<double> p_quaternion;
94 void Polish(Quaternion &quat);
95 };
96};
97
98#endif
99
Provide operations for quaternion arithmetic.
Definition Quaternion.h:36
Quaternion & operator=(const Quaternion &quat)
Assign value of quaternion class to another quaternion.
Definition Quaternion.cpp:95
std::vector< double > ToMatrix()
Converts quaternion to 3x3 rotational matrix.
Definition Quaternion.cpp:75
std::vector< double > ToAngles(int axis3, int axis2, int axis1)
Return the camera angles (right ascension, declination, and twist) for the quaternion.
Definition Quaternion.cpp:260
Quaternion Conjugate()
Returns the conjugate of the quaternion.
Definition Quaternion.cpp:197
Quaternion()
Constructs an empty quaternion.
Definition Quaternion.cpp:26
Quaternion operator*(const Quaternion &quat) const
Multiply two Naif quaternions to create a new quaternion.
Definition Quaternion.cpp:147
~Quaternion()
Destroys the Quaternion object.
Definition Quaternion.cpp:49
double & operator[](int index)
Return a member of a quaternion.
Definition Quaternion.h:79
std::vector< double > Qxv(const std::vector< double > &vin)
Multiply a vector by a quaternion (rotate the vector)
Definition Quaternion.cpp:215
std::vector< double > GetQuaternion() const
Return the quaternion as a vector.
Definition Quaternion.h:54
void Set(std::vector< double >)
Sets the quaternion value.
Definition Quaternion.cpp:56
Quaternion & operator*=(const Quaternion &quat)
Multiply current Naif quaternion by another Naif quaternion, replacing the current quaternion.
Definition Quaternion.cpp:117
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16