Quaternions

    #include <gfx/quat.h>

class Quat

Constructor Methods

The Quat class defines the following set of constructors:

    Quat();                                        // Initializes to identity quaternion
    Quat(double x, double y, double z, double w);  // 
    Quat(const Vec3& a, double b);                 // 
    Quat(const Quat& q);                           // 
    Quat::ident();

Arithmetic Methods

    Quat& operator=(const Quat& q);
    Quat& operator+=(const Quat& q);
    Quat& operator-=(const Quat& q);
    Quat& operator=(double d);
    Quat& operator*=(double d);
    Quat& operator/=(double d);
    Quat operator+(const Quat& q, const Quat& r)
    Quat operator*(const Quat& q, const Quat& r)
    Quat operator*(const Quat& q, double s)
    Quat operator*(double s, const Quat& q)
    Quat operator/(const Quat& q, double s)
    double norm2(const Quat& q);
    Quat conjugate(const Quat& q);
    Quat inverse(const Quat& q);
    double unitize(Quat& q);
    Quat axis_to_quat(const Vec3& a, double phi);
    Mat4 quat_to_matrix(const Quat& q);
    Mat4 unit_quat_to_matrix(const Quat& q);
    Quat slerp(const Quat& from, const Quat& to, double t);

Quaternions can also be read from and written to C++ iostreams using the standard << and >> operators.