Files Class List
Quat< T > Class Template Reference

Detailed Description

template<typename T>
class cy::Quat< T >

Quaternion class.

#include <cyQuat.h>

Public Member Functions

Set & Get value functions
void Zero ()
 Sets the scalar part to 1 and vector part to zero vector.
 
void Reset ()
 Sets the scalar part to 1 and vector part to zero vector.
 
void Set (T _s, Vec3< T > const &_v)
 Sets the scalar part to 1 and vector part to zero vector.
 
void Set (T _s, T _x, T _y, T _z)
 Sets the scalar part to 1 and vector part to zero vector.
 
void Set (T *array)
 Sets the scalar part to 1 and vector part to zero vector.
 
void SetRotation (T angle, Vec3< T > const &axis)
 Sets the scalar part to 1 and vector part to zero vector.
 
void SetRotation (T angle, T axisX, T axisY, T axisZ)
 Sets the scalar part to 1 and vector part to zero vector.
 
void GetValue (T *array)
 Sets the scalar part to 1 and vector part to zero vector.
 
GetRotationAngle ()
 Returns rotation angle in radiants.
 
Vec3< T > GetRotationAxis ()
 Sets the scalar part to 1 and vector part to zero vector.
 
Length and Normalize functions
void Normalize ()
 
Quat GetNormalized () const
 
LengthSquared () const
 
Length () const
 
Matrix conversion functions
void ToMatrix3 (Matrix3< T > &m) const
 
void ToMatrix4 (Matrix4< T > &m) const
 
Matrix3< T > ToMatrix3 () const
 
Matrix4< T > ToMatrix4 () const
 
Unary operators
Quat operator- () const
 
Binary operators
Quat operator* (Quat const &q) const
 
Quat operator+ (Quat const &q) const
 
Quat operator- (Quat const &q) const
 
Quat operator* (T const &f) const
 
Assignment operators
Quatoperator*= (Quat const &q)
 
Quatoperator+= (Quat const &q)
 
Quatoperator-= (Quat const &q)
 
Quatoperator*= (T const &f)
 
Test operators
int operator== (Quat const &q) const
 
int operator!= (Quat const &q) const
 

Public Attributes

s
 scaler part
 
Vec3< T > v
 vector part
 

Friends

Quat operator* (T f, Quat const &q)
 

Constructors

Vec3< T > const & _v: s(_s)
 
 Quat () CY_CLASS_FUNCTION_DEFAULT Quat(T _s
 
Vec3< T > const v (_v)
 
 Quat (T _s, T _x, T _y, T _z)
 
 Quat (Quat const &q)
 

Vector rotations

Rotates the given vector using the quaternion. Note that the quaternion must be a unit quaternion.

Vec3< T > GetRotatedVector (Vec3< T > const &p)
 
void RotateVector (Vec3< T > &p)