1#ifndef OPAL_QUATERNION_H
2#define OPAL_QUATERNION_H
36 Quaternion(
const double&,
const double&,
const double&,
const double&);
40 Quaternion(
const double&,
const ippl::Vector<double, 3>&);
105 ippl::Vector<double, 3>
imag()
const;
115 ippl::Vector<double, 3>
rotate(
const ippl::Vector<double, 3>&)
const;
145 const double& x0,
const double& x1,
const double& x2,
const double& x3)
146 :
Vector<double, 4>(x0, x1, x2, x3) {
156 :
Quaternion(realPart, vec(0), vec(1), vec(2)) {
179 ippl::Vector<double, 3> vec((*
this)(1), (*
this)(2), (*
this)(3));
Quaternion getQuaternion(ippl::Vector< double, 3 > vec, ippl::Vector< double, 3 > reference)
Return a unit quaternion that rotates vec onto reference.
ippl::Vector< T, Dim > Vector
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.
Quaternion storage and rotation algebra used by OPALX geometry code.
bool isPure() const
Return true if the scalar part is approximately zero.
Quaternion & normalize()
Normalize the quaternion in place.
double real() const
Return the scalar part .
Quaternion conjugate() const
Return the quaternion conjugate .
matrix3x3_t getRotationMatrix() const
Convert the quaternion to a 3x3 rotation matrix.
Quaternion inverse() const
Return the multiplicative inverse.
ippl::Vector< double, 3 > rotate(const ippl::Vector< double, 3 > &) const
Rotate a spatial vector by a unit quaternion.
Quaternion & operator*=(const Quaternion &)
Quaternion operator/(const double &) const
bool isUnit() const
Return true if within a fixed tolerance.
Quaternion & operator=(const Quaternion &)=default
Quaternion operator*(const double &) const
Quaternion()
Construct the identity rotation quaternion .
bool isPureUnit() const
Return true if the quaternion is both pure and unit length.
double length() const
Return the Euclidean norm .
ippl::Vector< double, 3 > imag() const
Return the vector part .
double Norm() const
Return .