ofDocsdocumentation math ofQuaternion

ofQuaternion


asVec3( )

ofVec3f asVec3()

asVec4( )

ofVec4f asVec4()

conj( )

ofQuaternion conj()

Conjugate


get( ... )

void get(ofMatrix4x4 &matrix)

getEuler( )

ofVec3f getEuler()

Calculate and return the rotation as euler angles


getRotate( ... )

void getRotate(float &angle, ofVec3f &vec)

getRotate( ... )

void getRotate(float &angle, float &x, float &y, float &z)

Return the angle and vector components represented by the quaternion.


inverse( )

const ofQuaternion inverse()

Multiplicative inverse method

q^(-1) = q^*/(q.q^*)

length( )

float length()

Length of the quaternion = sqrt(vec . vec)


length2( )

float length2()

Length of the quaternion = vec . vec


makeRotate( ... )

void makeRotate(const ofVec3f &vec1, const ofVec3f &vec2)

Make a rotation Quat which will rotate vec1 to vec2. Generally take a dot product to get the angle between these and then use a cross product to get the rotation axis Watch out for the two special cases when the vectors are co-incident or opposite in direction.


makeRotate( ... )

void makeRotate(float angle, const ofVec3f &vec)

makeRotate( ... )

void makeRotate(float angle, float x, float y, float z)

\briefSet a quaternion which will perform a rotation of an angle around the axis given by the vector(x,y,z).

Define Spherical Linear interpolation method also


makeRotate( ... )

void makeRotate(float angle1, const ofVec3f &axis1, float angle2, const ofVec3f &axis2, float angle3, const ofVec3f &axis3)

makeRotate_original( ... )

void makeRotate_original(const ofVec3f &vec1, const ofVec3f &vec2)

normalize( )

void normalize()

ofQuaternion( ... )

ofQuaternion(const glm::quat &q)

ofQuaternion( ... )

ofQuaternion(const ofVec4f &v)

ofQuaternion( )

ofQuaternion()

\name Constructor {


ofQuaternion( ... )

ofQuaternion(float angle, const ofVec3f &axis)

ofQuaternion( ... )

ofQuaternion(float angle1, const ofVec3f &axis1, float angle2, const ofVec3f &axis2, float angle3, const ofVec3f &axis3)

ofQuaternion( ... )

ofQuaternion(float x, float y, float z, float w)

operator!=( ... )

bool operator!=(const ofQuaternion &q)

operator*( ... )

const ofQuaternion operator*(const ofQuaternion &rhs)

operator*( ... )

ofVec3f operator*(const ofVec3f &v)

operator*( ... )

const ofQuaternion operator*(float rhs)

operator*=( ... )

ofQuaternion & operator*=(const ofQuaternion &rhs)

operator*=( ... )

ofQuaternion & operator*=(float rhs)

operator+( ... )

const ofQuaternion operator+(const ofQuaternion &rhs)

operator+=( ... )

ofQuaternion & operator+=(const ofQuaternion &rhs)

operator-( ... )

const ofQuaternion operator-(const ofQuaternion &rhs)

operator-( )

const ofQuaternion operator-()

operator-=( ... )

ofQuaternion & operator-=(const ofQuaternion &rhs)

operator/( ... )

const ofQuaternion operator/(const ofQuaternion &denom)

operator/( ... )

ofQuaternion operator/(float rhs)

operator/=( ... )

ofQuaternion & operator/=(const ofQuaternion &denom)

operator/=( ... )

ofQuaternion & operator/=(float rhs)

operator=( ... )

ofQuaternion & operator=(const ofQuaternion &q)

\name Operators {


operator==( ... )

bool operator==(const ofQuaternion &q)

operator[]( ... )

float & operator[](int i)

\name Getters {


operator[]( ... )

float operator[](int i)

set( ... )

void set(const ofMatrix4x4 &matrix)

set( ... )

void set(const ofVec4f &v)

set( ... )

void set(float x, float y, float z, float w)

\name Setters {


slerp( ... )

void slerp(float t, const ofQuaternion &from, const ofQuaternion &to)

Spherical Linear Interpolation.

As t goes from 0 to 1, the Quat object goes from "from" to "to".


w( )

float & w()

w( )

float w()

x( )

float & x()

x( )

float x()

y( )

float & y()

y( )

float y()

z( )

float & z()

z( )

float z()

zeroRotation( )

bool zeroRotation()

return true if the Quat represents a zero rotation, and therefore can be ignored in computations.