FBase | +----FQuaternion
#include <Flek/FQuaternion.H>
The Quaternion class.
FQuaternion::FQuaternion();
Default constructor - create an identity quaternionFQuaternion::FQuaternion(const FVector3& vec);
Construct from a vector. Scalar is set to 0FQuaternion::FQuaternion(const FVector3& vec, double scalar);
Constructor from a vector and a scalarFQuaternion::FQuaternion(double scalar, const FVector3& vec);
Same as above, but with reverse orderFQuaternion::FQuaternion(double x, double y, double z, double scalar=0.0);
Construct from 3/4 individual values. Scalar is set to 0 by defaultFQuaternion::FQuaternion(const FQuaternion& quat);
Copy constructor
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
friend FQuaternion FQuaternion::conjugate(const FQuaternion& quat);
Compute conjugate of this quaternion which -v,s
virtual FBase * FQuaternion::copy(void);
Make a copy of the object implement FBase class pure virtual function
double FQuaternion::get_angle(void);
Get the angle of rotation. Returns value between 0 and PIfriend double FQuaternion::get_angle(const FQuaternion& quat);
Get the angle of rotation. Returns value between 0 and PI Computes angle after normalizing the quaternion
friend FVector3 FQuaternion::get_axis(const FQuaternion& quat);
Get the axis of rotation. Returns unit axis
void FQuaternion::get_axis_and_angle(FVector3& axis, double& theta);
Get the axis and angle.
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
friend double FQuaternion::length(const FQuaternion& quat);
Length of a quaternion
friend double FQuaternion::lengthsqr(const FQuaternion& quat);
Square of the length of a quaternion
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
friend double FQuaternion::normsqr(const FQuaternion& quat);
For consistency define norm and normsqr also
friend FQuaternion FQuaternion::operator * (const FQuaternion& q, double scalar);
Post-multiplication by a scalarfriend FQuaternion FQuaternion::operator * (double scalar, const FQuaternion& q);
Pre-multiplication by a scalarafriend FQuaternion FQuaternion::operator * (const FQuaternion& q1, const FQuaternion& q2);
Multiplication of 2 quaternionsfriend 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.0friend FQuaternion FQuaternion::operator * (const FVector3& v, const FQuaternion& q);
Pre-multiplication of a quaternion by a FVector3
friend FQuaternion FQuaternion::operator -(const FQuaternion& q);
Negation
friend FQuaternion FQuaternion::operator /(const FQuaternion& q, double scalar);
Division by a scalar
friend ostream& FQuaternion::operator <<(ostream& o, const FQuaternion& quat);
Insertion and extraction operators
FQuaternion& FQuaternion::operator =(const FQuaternion& quat);
Assignment operatorFQuaternion& FQuaternion::operator =(const FVector3& vec);
Assignment from FVector3
friend istream& FQuaternion::operator >>(istream& i, FQuaternion& quat);
Insertion and extraction operators
double& FQuaternion::operator [] (uint index);
Access the elements of the quaternion. Indices start at 0 and the scalar is at index=3
void FQuaternion::reset(void);
Reset the quaternion to its default state - identity.
void FQuaternion::scale_angle(double scale_factor);
Scale the angle by the given scale factor
void FQuaternion::set(const FVector3& vec, double scalar=0.0);
Set the vector and scalar parts of the quaternionvoid FQuaternion::set(double x, double y, double z, double scalar=0.0);
Set the vector and scalar parts of the quaternion
void FQuaternion::set_angle(double theta);
Change the angle to a new value. Use same axis as before
void FQuaternion::set_axis_and_angle(const FVector3& axis, double theta);
Set the axis and angle.
FMatrix3x3 FQuaternion::to_matrix(void);
Convert to a rotation matrix. Assumes that quaternion has been normalized
FQuaternion::~FQuaternion();
Destructor