Engine
Quaternion Struct Reference

data structure reprenseting a Quaternion. More...

#include <quaternion.h>

Public Member Functions

 Quaternion (GLfloat angle, Vector3Gf axis)
 
 Quaternion (Vector3Gf axis)
 
GLfloat squaredNorm () const
 
GLfloat norm () const
 
void normalize ()
 
Quaternion conjugate () const
 
Quaternion inv () const
 
Eigen::Matrix< GLfloat, 3, 3 > toRotationMatrix ()
 
Quaternion operator+ (const Quaternion &q) const
 
Quaternion operator- (const Quaternion &q) const
 
Quaternion operator* (const Quaternion &q) const
 
Quaternion operator/ (const GLfloat &s) const
 
Quaternion operator/ (const Quaternion &q) const
 

Public Attributes

GLfloat r
 
Vector3Gf im
 

Friends

Quaternion operator* (const Quaternion q, const GLfloat &s)
 
Quaternion operator* (const GLfloat &s, const Quaternion q)
 
std::ostream & operator<< (std::ostream &os, const Quaternion &q)
 

Detailed Description

data structure reprenseting a Quaternion.

Constructor & Destructor Documentation

Quaternion::Quaternion ( GLfloat  angle,
Vector3Gf  axis 
)

Builds a quaternion in polar form. Used for rotations

Quaternion::Quaternion ( Vector3Gf  axis)

Builds a purely imaginary quaternion.

Member Function Documentation

Quaternion Quaternion::conjugate ( ) const
Returns
the conjugate of this quaternion
Quaternion Quaternion::inv ( ) const
Returns
the inverse of this quaternion
GLfloat Quaternion::norm ( ) const
Returns
the norm of the quaternion
void Quaternion::normalize ( )

divides this quaternion by its norm

GLfloat Quaternion::squaredNorm ( ) const
Returns
the squared norm of the quaternion

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