56 #ifndef _GAMS_POSE_QUATERNION_H_ 57 #define _GAMS_POSE_QUATERNION_H_ 134 Quaternion &into,
const Quaternion &lhs,
const Quaternion &rhs);
143 Quaternion &
operator*=(
const Quaternion &rhs);
151 Quaternion
operator*(
const Quaternion &rhs)
const;
224 double angle_to(
const Quaternion &target)
const;
227 constexpr
double x()
const;
230 constexpr
double y()
const;
233 constexpr
double z()
const;
236 constexpr
double w()
const;
239 double x(
double new_x);
242 double y(
double new_y);
245 double z(
double new_z);
248 double w(
double new_w);
275 void scale(
double s);
283 Quaternion
exp()
const;
297 Quaternion
ln()
const;
311 Quaternion
pow(
double e)
const;
325 Quaternion
pow(
const Quaternion &e)
const;
346 Quaternion
slerp(
const Quaternion &o,
double t);
360 void slerp_this(
const Quaternion &o,
double t);
406 #include "Quaternion.inl" Quaternion exp() const
Calculate e to the power of this quaternion, return result as new quaternion.
constexpr double z() const
getter of z (or k) part of quaternion
double m21() const
Row 2 Column 1 of orientation matrix equivalent to this quaternion.
void from_linear_vector(double x, double y, double z)
gams::pose::AngularVector OrientationVector
Container for Orientation information, not bound to a frame.
double m32() const
Row 3 Column 2 of orientation matrix equivalent to this quaternion.
Quaternion pow(double e) const
Calculate this quaternion raised to a scalar power, return result in a new quaternion.
void to_angular_vector(double &rx, double &ry, double &rz) const
constexpr Quaternion()
Default constructor.
double m23() const
Row 2 Column 3 of orientation matrix equivalent to this quaternion.
constexpr double w() const
getter of w (or real scalar) part of quaternion
void ln_this()
Calculate natural log of this quaternion, store result in this quaternion.
double imag() const
Returns the magnitude of imaginary part of this quaternion.
Quaternion & negate()
Flip the sign of all parts of the quaternion; equivalent to (but potentially faster than) this->scale...
void from_angular_vector(double rx, double ry, double rz)
Quaternion & conjugate()
Conjugate this quaternion in-place; may use in place of invert for unit quaternions for better perfor...
Quaternion ln() const
Calculate the natural log of this quaternion, return result in a new quaternion.
Quaternion & operator*=(const Quaternion &rhs)
Calculate hamilton product, this * rhs, and store into this.
Quaternion slerp(const Quaternion &o, double t)
If *this and o are unit quaternions, interpolate a quaternion that is partially between them...
double angle_to(const Quaternion &target) const
Calculates the angle between the orientations represented by this, and the target Quaternion...
double mag() const
Returns the magnitude of this quaternion.
double m31() const
Row 3 Column 1 of orientation matrix equivalent to this quaternion.
double m11() const
Row 1 Column 1 of orientation matrix equivalent to this quaternion.
void invert()
Inverts this quaternion to its reciprical.
void exp_this()
Calculate e to the power of this quaternion, store result in this quaternion.
Contains all GAMS-related tools, classes and code.
double m12() const
Row 1 Column 2 of orientation matrix equivalent to this quaternion.
constexpr Quaternion operator-() const
Copy and conjugate this quaternion.
double mag_squared() const
Returns the magnitude of this quaternion, squared.
double inner_product(const Quaternion &rhs) const
Calculates the Quaternion inner-product between this, and the right-hand-side, which is the sum of th...
void orient_by(Quaternion rot)
Treat this quaternion as a position quaternion (w should be zero), and orient it by the orientation r...
Used internally to implement angle operations.
Quaternion operator*(const Quaternion &rhs) const
Calculate hamilton product, this * rhs, and return new Quaternion.
void slerp_this(const Quaternion &o, double t)
If *this and o are unit quaternions, interpolate a quaternion that is partially between them...
double m13() const
Row 1 Column 3 of orientation matrix equivalent to this quaternion.
void to_linear_vector(double &x, double &y, double &z) const
void pre_multiply(const Quaternion &lhs)
Calculate hamilton product, lhs * this, and store into this.
double m33() const
Row 3 Column 3 of orientation matrix equivalent to this quaternion.
constexpr double x() const
getter of x (or i) part of quaternion
double dot_product(const Quaternion &rhs) const
Calculates the Quaternion dot product between this, and the right-hand-side; this is the inner-produc...
void pow_this(double e)
Calculate this quaternion raised to a scalar power, store result in this quaternion.
constexpr double y() const
getter of y (or j) part of quaternion
static void hamilton_product(Quaternion &into, const Quaternion &lhs, const Quaternion &rhs)
Calculates the hamilton product of two quaternions, into a third.
double m22() const
Row 2 Column 2 of orientation matrix equivalent to this quaternion.
void scale(double s)
Multiply each part of this quaternion by s.