Itasca C++ Interface
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
Quat2 Class Reference

2D quaternion-like utility class. In this case only the angle (in radians) is stored as opposed to the complex number. Multiplication of quaternions is supposed to result in a combined rotation which, in 2D, is the addition of the angles. This is for consitency with the Quat3 class. More...

#include <quat.h>

Public Member Functions

 Quat2 ()
 Default constructor.
 
 Quat2 (const double &a)
 Constructor initializing the angle.
 
 ~Quat2 ()
 Destructor.
 
 Quat2 (const Quat2 &q)
 Copy constructor.
 
constexpr Quat2operator= (const Quat2 &in)
 Equals operator.
 
void setQuat (const double &a)
 Set the angle.
 
const double & ang () const
 Access the angle.
 
double & rang ()
 Access a reference to the angle.
 
void reset ()
 Reset the angle to 0.
 
void ident ()
 Reset to the identity.
 
BASE_EXPORT DMatrix< 2, 2 > quatToMatrix () const
 Convert the quaternion to a rotation matrix.
 
BASE_EXPORT void fromMatrix (const DMatrix< 2, 2 > &)
 Convert a matrix into a quaternion.
 
BASE_EXPORT void fromAxisAngle (const DVect2 &, const double &)
 
BASE_EXPORT void fromEuler (const DAVect2 &v)
 
BASE_EXPORT void incrementAxisAngle (const DVect2 &, const double &)
 Increment by this rotation. In this case the axis is ignored.
 
BASE_EXPORT void spinAboutZ (const double &)
 Just spin about the Z axis.
 
BASE_EXPORT DVect2 rotate (const DVect2 &v) const
 Rotate a DVect2 by the quaternian to get a new DVect2.
 
BASE_EXPORT void fromUnitAxes (const DVect2 &, const DVect2 &)
 
BASE_EXPORT void increment (const DAVect2 &)
 Increment the quaternion due to a rotation about Z by the DAVect.
 
void conj ()
 Convert to the conjugate quaternion - rotation by the opposite sign.
 
Quat2 getConj () const
 Return the conjugate of the quaternion.
 
void normalize ()
 Normalize the quaternion.
 
Quat2 operator* (const double &d) const
 Multiplication by a double.
 
Quat2 operator/ (const double &d) const
 Division by a double.
 
Quat2 operator* (const Quat2 &v) const
 
Quat2 operator+ (const Quat2 &v) const
 Addition of quaterions. This is also the composition of rotations in 2D.
 
const Quat2operator*= (const double &d)
 In place multiplaction by a double.
 
const Quat2operator/= (const double &d)
 In place division by a double.
 
const Quat2operator*= (const Quat2 &v)
 
const Quat2operator+= (const Quat2 &v)
 
bool operator== (const Quat2 &v) const
 Euality operator.
 

Static Public Member Functions

static BASE_EXPORT Quat2 identity ()
 Return the identity quaternion.
 
static BASE_EXPORT Quat2 fromVect (const DVect2 &v)
 Convert a DVect2 into a quaternion. This assumes a rotation from the positive x axis.
 

Friends

Quat2 operator* (const double &d, const Quat2 &p2)
 Multiplication of a double times a quaternion.
 

Detailed Description

2D quaternion-like utility class. In this case only the angle (in radians) is stored as opposed to the complex number. Multiplication of quaternions is supposed to result in a combined rotation which, in 2D, is the addition of the angles. This is for consitency with the Quat3 class.

Member Function Documentation

◆ fromAxisAngle()

void Quat2::fromAxisAngle ( const DVect2 & ,
const double & d )

Take an axis-angle representation and convert it to a quaternion (angles in DEGREES). In this case the axis is ignored.

◆ fromUnitAxes()

void Quat2::fromUnitAxes ( const DVect2 & v,
const DVect2 &  )

Take 1 orthogonal axis for an axis system and convert to a quaternion. The second axis is ignored.

◆ operator*()

Quat2 Quat2::operator* ( const Quat2 & v) const
inline

Multiplication of two quaternions. This is the composition of rotations which corresponds to the addition of the angles.

◆ operator*=()

const Quat2 & Quat2::operator*= ( const Quat2 & v)
inline

In place multiplication of two quaternions. This is the composition of rotations which corresponds to the addition of the angles.

◆ operator+=()

const Quat2 & Quat2::operator+= ( const Quat2 & v)
inline

In place addition of two quaternions. This is the composition of rotations which corresponds to the addition of the angles.


The documentation for this class was generated from the following files: