Files Class List
Quat< TYPE > Class Template Reference

Detailed Description

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

Quaternion class.

#include <cyQuat.h>

Public Member Functions

Constructors
 Quat ()
 
 Quat (TYPE _s, const Point3< TYPE > &_v)
 
 Quat (TYPE _s, TYPE _x, TYPE _y, TYPE _z)
 
 Quat (const Quat &q)
 
Set & Get value functions
void Zero ()
 
void Reset ()
 
void Set (TYPE _s, const Point3< TYPE > &_v)
 
void Set (TYPE _s, TYPE _x, TYPE _y, TYPE _z)
 
void Set (TYPE *array)
 
void SetRotation (TYPE angle, const Point3< TYPE > &axis)
 
void SetRotation (TYPE angle, TYPE axisX, TYPE axisY, TYPE axisZ)
 
void GetValue (TYPE *array)
 
TYPE GetRotationAngle ()
 
Point3< TYPE > GetRotationAxis ()
 
Length and Normalize functions
void Normalize ()
 
Quat GetNormalized () const
 
TYPE LengthSquared () const
 
TYPE Length () const
 
Matrix conversion functions
void ToMatrix3 (Matrix3< TYPE > &m) const
 
void ToMatrix4 (Matrix4< TYPE > &m) const
 
Matrix3< TYPE > ToMatrix3 () const
 
Matrix4< TYPE > ToMatrix4 () const
 
Unary operators
Quat operator- () const
 
Binary operators
Quat operator* (const Quat &q) const
 
Quat operator+ (const Quat &q) const
 
Quat operator- (const Quat &q) const
 
Quat operator* (TYPE f) const
 
Assignment operators
Quatoperator*= (const Quat &q)
 
Quatoperator+= (const Quat &q)
 
Quatoperator-= (const Quat &q)
 
Quatoperator*= (TYPE f)
 
Test operators
int operator== (const Quat &q) const
 
int operator!= (const Quat &q) const
 

Public Attributes

TYPE s
 
Point3< TYPE > v
 

Friends

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

Vector rotations

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

Point3< TYPE > GetRotatedVector (const Point3< TYPE > &p)
 
void RotateVector (Point3< TYPE > &p)
 

Member Function Documentation

§ Zero()

void Zero ( )

Sets the scalar part to 1 and vector part to zero vector.

§ Reset()

void Reset ( )

Sets the scalar part to 1 and vector part to zero vector.

§ Set() [1/3]

void Set ( TYPE  _s,
const Point3< TYPE > &  _v 
)

Sets the scalar part to 1 and vector part to zero vector.

§ Set() [2/3]

void Set ( TYPE  _s,
TYPE  _x,
TYPE  _y,
TYPE  _z 
)

Sets the scalar part to 1 and vector part to zero vector.

§ Set() [3/3]

void Set ( TYPE *  array)

Sets the scalar part to 1 and vector part to zero vector.

§ SetRotation() [1/2]

void SetRotation ( TYPE  angle,
const Point3< TYPE > &  axis 
)

Sets the scalar part to 1 and vector part to zero vector.

§ SetRotation() [2/2]

void SetRotation ( TYPE  angle,
TYPE  axisX,
TYPE  axisY,
TYPE  axisZ 
)

Sets the scalar part to 1 and vector part to zero vector.

§ GetValue()

void GetValue ( TYPE *  array)

Sets the scalar part to 1 and vector part to zero vector.

§ GetRotationAngle()

TYPE GetRotationAngle ( )

Returns rotation angle in radiants.

§ GetRotationAxis()

Point3<TYPE> GetRotationAxis ( )

Sets the scalar part to 1 and vector part to zero vector.

Member Data Documentation

§ s

TYPE s

scaler part

§ v

Point3<TYPE> v

vector part