ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
Quaternion Class Reference

#include <Quaternion.h>

Public Member Functions

 Quaternion (double qw=1., double qx=1., double qy=0., double qz=0.)
 
 Quaternion (const double &alpha_rad, const std::array< double, 3 > &n)
 create a quaternion, representing a rotation around a rotation axis (vector n) by an angel alpha More...
 
double qw () const
 
double qx () const
 
double qy () const
 
double qz () const
 
double magnitude2 () const
 
void scale (double s)
 
void scaleinv (double s)
 
void normalize ()
 
void conjugate ()
 
void inverse ()
 
void add (const Quaternion &q)
 
void multiply_left (const Quaternion &q)
 
void operator*= (const Quaternion &q)
 
std::array< double, 3 > rotate (const std::array< double, 3 > &d) const
 
void rotateInPlace (std::array< double, 3 > &d) const
 
std::array< double, 3 > rotateinv (const std::array< double, 3 > &d) const
 
void rotateinvInPlace (std::array< double, 3 > &d) const
 
void differentiate (const std::array< double, 3 > &w, Quaternion &dqdt) const
 
void getRotMatrix (double R[3][3]) const
 
void getRotinvMatrix (double R[3][3]) const
 
bool isNormalized () const
 
void check () const
 

Detailed Description

Author
Martin Bernreuther

Constructor & Destructor Documentation

◆ Quaternion()

Quaternion::Quaternion ( const double &  alpha_rad,
const std::array< double, 3 > &  n 
)

create a quaternion, representing a rotation around a rotation axis (vector n) by an angel alpha

Parameters
alpha_radthe rotation angle in radiant
nrotation axis represented as a vector (will be normalized)

Member Function Documentation

◆ rotate()

std::array< double, 3 > Quaternion::rotate ( const std::array< double, 3 > &  d) const

apply the rotation represented by tis quaternion to d

Parameters
dthe vector to be rotated
Returns
result vector of the rotation

◆ rotateInPlace()

void Quaternion::rotateInPlace ( std::array< double, 3 > &  d) const
inline

apply the rotation represented by tis quaternion to d. The result vector is stored to d.

Parameters
dthe vector to be rotated

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