The Fast Light Environment Kit



class FQuaternion

Class Hierarchy

FBase
   |
   +----FQuaternion

Include Files

#include <Flek/FQuaternion.H>

Description

The Quaternion class.

Methods


Variable Descriptions

FVector3 v;

Vector component

double w;

Scalar component

Method Descriptions

FQuaternion

FQuaternion::FQuaternion();

Default constructor - create an identity quaternion

FQuaternion::FQuaternion(const FVector3& vec);

Construct from a vector. Scalar is set to 0

FQuaternion::FQuaternion(const FVector3& vec, double scalar);

Constructor from a vector and a scalar

FQuaternion::FQuaternion(double scalar, const FVector3& vec);

Same as above, but with reverse order

FQuaternion::FQuaternion(double x, double y, double z, double scalar=0.0);

Construct from 3/4 individual values. Scalar is set to 0 by default

FQuaternion::FQuaternion(const FQuaternion& quat);

Copy constructor

I

static FQuaternion FQuaternion::I(void);

Class member functions which return the identity quaternion Identity quaternion is with the all vector components=0 and scalar=1

conjugate

friend FQuaternion FQuaternion::conjugate(const FQuaternion& quat);

Compute conjugate of this quaternion which -v,s

copy

virtual FBase * FQuaternion::copy(void);

Make a copy of the object implement FBase class pure virtual function

get_angle

double FQuaternion::get_angle(void);

Get the angle of rotation. Returns value between 0 and PI

friend double FQuaternion::get_angle(const FQuaternion& quat);

Get the angle of rotation. Returns value between 0 and PI Computes angle after normalizing the quaternion

get_axis

friend FVector3 FQuaternion::get_axis(const FQuaternion& quat);

Get the axis of rotation. Returns unit axis

get_axis_and_angle

void FQuaternion::get_axis_and_angle(FVector3& axis, double& theta);

Get the axis and angle.

identity

static FQuaternion FQuaternion::identity(void);

Class member functions which return the identity quaternion Identity quaternion is with the all vector components=0 and scalar=1

length

friend double FQuaternion::length(const FQuaternion& quat);

Length of a quaternion

lengthsqr

friend double FQuaternion::lengthsqr(const FQuaternion& quat);

Square of the length of a quaternion

normalize

friend double FQuaternion::normalize(FQuaternion& quat);

Normalize a quaternion - make it a unit quaternion Returns the original length of the quaternion If length is 0, nothing is changed

normsqr

friend double FQuaternion::normsqr(const FQuaternion& quat);

For consistency define norm and normsqr also

operator *

friend FQuaternion FQuaternion::operator * (const FQuaternion& q, double scalar);

Post-multiplication by a scalar

friend FQuaternion FQuaternion::operator * (double scalar, const FQuaternion& q);

Pre-multiplication by a scalara

friend FQuaternion FQuaternion::operator * (const FQuaternion& q1, const FQuaternion& q2);

Multiplication of 2 quaternions

friend FQuaternion FQuaternion::operator * (const FQuaternion& q, const FVector3& v);

Post-multiplication of a quaternion by a FVector3 Same as above, except FVector3 is promoted to quaternion with scalar value 0.0

friend FQuaternion FQuaternion::operator * (const FVector3& v, const FQuaternion& q);

Pre-multiplication of a quaternion by a FVector3

operator -

friend FQuaternion FQuaternion::operator -(const FQuaternion& q);

Negation

operator /

friend FQuaternion FQuaternion::operator /(const FQuaternion& q, double scalar);

Division by a scalar

operator <<

friend ostream& FQuaternion::operator <<(ostream& o, const FQuaternion& quat);

Insertion and extraction operators

operator =

FQuaternion& FQuaternion::operator =(const FQuaternion& quat);

Assignment operator

FQuaternion& FQuaternion::operator =(const FVector3& vec);

Assignment from FVector3

operator >>

friend istream& FQuaternion::operator >>(istream& i, FQuaternion& quat);

Insertion and extraction operators

operator []

double& FQuaternion::operator [] (uint index);

Access the elements of the quaternion. Indices start at 0 and the scalar is at index=3

reset

void FQuaternion::reset(void);

Reset the quaternion to its default state - identity.

scale_angle

void FQuaternion::scale_angle(double scale_factor);

Scale the angle by the given scale factor

set

void FQuaternion::set(const FVector3& vec, double scalar=0.0);

Set the vector and scalar parts of the quaternion

void FQuaternion::set(double x, double y, double z, double scalar=0.0);

Set the vector and scalar parts of the quaternion

set_angle

void FQuaternion::set_angle(double theta);

Change the angle to a new value. Use same axis as before

set_axis_and_angle

void FQuaternion::set_axis_and_angle(const FVector3& axis, double theta);

Set the axis and angle.

to_matrix

FMatrix3x3 FQuaternion::to_matrix(void);

Convert to a rotation matrix. Assumes that quaternion has been normalized

~FQuaternion

FQuaternion::~FQuaternion();

Destructor

© 2000 the Flek Development team.
Generated by ScanDoc
Last Updated: Tue May 15 8:50:06 2001