56 #ifndef _GAMS_POSE_QUATERNION_H_
57 #define _GAMS_POSE_QUATERNION_H_
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);
406 #include "Quaternion.inl"
Used internally to implement angle operations.
void to_linear_vector(PositionVector &loc) const
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...
Quaternion ln() const
Calculate the natural log of this quaternion, return result in a new quaternion.
double x(double new_x)
getter of x (or i) part of quaternion
double m21() const
Row 2 Column 1 of orientation matrix equivalent to this quaternion.
void to_angular_vector(double &rx, double &ry, double &rz) const
constexpr Quaternion operator-() const
Copy and conjugate this quaternion.
double m12() const
Row 1 Column 2 of orientation matrix equivalent to this quaternion.
Quaternion & operator*=(const Quaternion &rhs)
Calculate hamilton product, this * rhs, and store into this.
Quaternion(double rx, double ry, double rz)
Constructor which converts a orientation vector, specified in individual terms, into the correspondin...
constexpr double x() const
getter of x (or i) part of quaternion
Quaternion & negate()
Flip the sign of all parts of the quaternion; equivalent to (but potentially faster than) this->scale...
double z(double new_z)
getter of z (or k) part of quaternion
Quaternion pow(double e) const
Calculate this quaternion raised to a scalar power, return result in a new quaternion.
double m32() const
Row 3 Column 2 of orientation matrix equivalent to this quaternion.
double y(double new_y)
getter of y (or j) part of quaternion
double m31() const
Row 3 Column 1 of orientation matrix equivalent to this quaternion.
double m23() const
Row 2 Column 3 of orientation matrix equivalent to this quaternion.
void from_linear_vector(double x, double y, double z)
void slerp_this(const Quaternion &o, double t)
If *this and o are unit quaternions, interpolate a quaternion that is partially between them,...
void to_linear_vector(double &x, double &y, double &z) const
double mag_squared() const
Returns the magnitude of this quaternion, squared.
double m22() const
Row 2 Column 2 of orientation matrix equivalent to this quaternion.
constexpr double z() const
getter of z (or k) part of quaternion
void pre_multiply(const Quaternion &lhs)
Calculate hamilton product, lhs * this, and store into this.
void from_linear_vector(const PositionVector &loc)
double m13() const
Row 1 Column 3 of orientation matrix equivalent to this quaternion.
void pow_this(double e)
Calculate this quaternion raised to a scalar power, store result in this quaternion.
void scale(double s)
Multiply each part of this quaternion by s.
double angle_to(const Quaternion &target) const
Calculates the angle between the orientations represented by this, and the target Quaternion.
Quaternion exp() const
Calculate e to the power of this quaternion, return result as new quaternion.
double m33() const
Row 3 Column 3 of orientation matrix equivalent to this 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 orient_by(Quaternion rot)
Treat this quaternion as a position quaternion (w should be zero), and orient it by the orientation r...
Quaternion & conjugate()
Conjugate this quaternion in-place; may use in place of invert for unit quaternions for better perfor...
constexpr Quaternion(double x, double y, double z, double w)
Primary constructor.
static void hamilton_product(Quaternion &into, const Quaternion &lhs, const Quaternion &rhs)
Calculates the hamilton product of two quaternions, into a third.
void to_angular_vector(OrientationVector &rot) const
Quaternion pow(const Quaternion &e) const
Calculate this quaternion raised to a quaternion power, return result in a new quaternion.
constexpr Quaternion()
Default constructor.
Quaternion slerp(const Quaternion &o, double t)
If *this and o are unit quaternions, interpolate a quaternion that is partially between them,...
void exp_this()
Calculate e to the power of this quaternion, store result in this quaternion.
void from_angular_vector(const OrientationVector &rot)
void ln_this()
Calculate natural log of this quaternion, store result in this quaternion.
double m11() const
Row 1 Column 1 of orientation matrix equivalent to this quaternion.
constexpr double w() const
getter of w (or real scalar) part of quaternion
double w(double new_w)
setter of w (or real scalar) part of quaternion
void pow_this(const Quaternion &e)
Calculate this quaternion raised to a quaternion power, store result in this quaternion.
void invert()
Inverts this quaternion to its reciprical.
constexpr double y() const
getter of y (or j) part of quaternion
Quaternion(const PositionVector &loc)
Constructor which converts a position vector into the corresponding quaternion representation; x,...
void from_angular_vector(double rx, double ry, double rz)
double mag() const
Returns the magnitude of this quaternion.
double imag() const
Returns the magnitude of imaginary part of this quaternion.
Quaternion(const OrientationVector &rot)
Constructor which converts a orientation vector into the corresponding quaternion representation.
Quaternion operator*(const Quaternion &rhs) const
Calculate hamilton product, this * rhs, and return new Quaternion.
gams::pose::AngularVector OrientationVector
Container for Orientation information, not bound to a frame.
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015 Carnegie Mellon University.