115 return q0 == 1.0 &&
q1 == 0.0 &&
q2 == 0.0 &&
q3 == 0.0;
Implementation of a 3D quaternion (by Vitaliy).
Vec3D getEuler() const
Convert a quaternion to Euler angles. See Wikipedia for details.
void rotateBack(Vec3D &position) const
Applies the inverse rotation to a position.
Mdouble getComponent(int index) const
Returns the requested component of this Quaternion.
static Quaternion getUnitQuaternion(const Quaternion &a)
Returns a unit Quaternion based on a.
static Mdouble getDistanceSquared(const Quaternion &a, const Quaternion &b)
Calculates the squared distance between two Quaternion: .
void rotateTensor(SmallMatrix< 3, 3 > I) const
Quaternion operator*(Mdouble a) const
Multiplies by a scalar.
Quaternion & operator*=(Mdouble a)
Multiplies *this by a scalar.
MatrixSymmetric3D rotateInverseInertiaTensor(const MatrixSymmetric3D &invI) const
Converts the inverse inertia tensor from the reference frame to the lab frame; see See QuaternionsWou...
Quaternion()
Constructor; sets quaternion value to (1,0,0,0)
Implementation of a 3D vector (by Vitaliy).
void setComponent(int index, double val)
Sets the requested component of this Quaternion to the requested value.
void setLength(Mdouble length)
Make this Quaternion a certain length |q|=length.
Mdouble q2
the second component of the quaternion q = (q0,q1,q2,q3)
Quaternion angularVelocityBodyFixedFrameToAngularDisplacement(Vec3D v) const
void rotate(Vec3D &position) const
Applies the rotation to a position.
Quaternion angularDisplacementTimeDerivative(Vec3D v) const
Converts an angular momentum v=omega into a quaternion rate of change, q(t+dt)-q(t)/dt.
friend std::istream & operator>>(std::istream &is, Quaternion &a)
Adds elements to an input stream.
Vec3D getAxis() const
Converts the quaternions into a normal vector by rotating the vector x=(1,0,0); see See Wiki for deta...
Quaternion operator+(const Quaternion &a) const
Adds another quaternion and returns the result.
Mdouble getAngleZ() const
Converts a quaternion to the rotation angle in the XY plane (for Mercury2D). See Wikipedia for detail...
void setAngleZ(Mdouble psi)
Converts the rotation angle in the XY plane into a quaternion (for Mercury2D). See Wikipedia for deta...
static Mdouble getDistance(const Quaternion &a, const Quaternion &b)
Calculates the distance between two Quaternion: .
void setEuler(const Vec3D &e)
Convert Euler angles to a quaternion. See Wikipedia for details.
Mdouble q3
the third component of the quaternion q = (q0,q1,q2,q3)
void setOrientationViaNormal(Vec3D normal)
Used to the the normal of an InfiniteWall that has a normal into the x-direction by default...
Quaternion & operator+=(const Quaternion &a)
Adds another quaternion.
Quaternion & operator-=(const Quaternion &a)
Subtracts another quaternion.
Vec3D applyCInverse(Quaternion q) const
Converts quaternion rate of change into an angular momentum omega.
bool isEqualTo(const Quaternion &other, double tol) const
Checks if the length this Quaternion is equal the length of other with a certain tolerance.
void getRotationMatrix(SmallMatrix< 3, 3 > &A) const
Retrieves the rotation matrix.
Mdouble getLengthSquared() const
Calculates the squared length of this Quaternion: .
bool isUnity() const
Checks if the quaternion value is (1,0,0,0)
Quaternion operator-(const Quaternion &a) const
Subtracts another quaternion and returns the result.
void updateAngularDisplacement(Vec3D angularVelocityDt)
Data type for small dense matrix.
friend std::ostream & operator<<(std::ostream &os, const Quaternion &a)
Adds elements to an output stream.
Quaternion & operator/=(Mdouble a)
Divides by a scalar.
Mdouble q0
the zeroth component of the quaternion q = (q0,q1,q2,q3)
Implementation of a 3D symmetric matrix.
Quaternion operator/(Mdouble a) const
Divides by a scalar.
Mdouble q1
the first component of the quaternion q = (q0,q1,q2,q3)
void normalise()
Makes this Quaternion unit length |q|=1.
void setUnity()
Sets quaternion value to (1,0,0,0)
Mdouble getLength() const
Calculates the length of this Quaternion: .