#include <quaternion.hpp>
Definition at line 50 of file quaternion.hpp.
Public Member Functions | |
quaternion | conjugate () const |
Returns the conjugate of the quaternion: w - xi - yj - zk. | |
double | dot (const quaternion &) const |
quaternion | inverse () const |
Returns the inverse of the quaternion: inverse / norm. | |
double | norm () const |
Returns the norm of the quaterion: sqrt(w*w + x*x + y*y + z*z). | |
void | normalize () |
Normalizes the quaternion; sets w*w + x*x + y*y + z*z == 1. | |
quaternion | operator* (const double &) const |
quaternion | operator* (const quaternion &) const |
quaternion | operator+ (const quaternion &) const |
quaternion & | operator= (const transform &) |
Sets the quaternion from a rotation matrix (ignores any translation component in the transform). | |
quaternion & | operator= (const quaternion &) |
Assignment operator; sets the quaternion equal to the given quaternion. | |
quaternion (const transform &) | |
Creates a quaternion from a rotation matrix (ignores any translation component in the transform). | |
quaternion (const gsgl::string &) | |
Intialize the quaternion from a string of numbers "x y z w"; the resulting quaternion is w + xi + yj + zk. | |
quaternion (const quaternion &) | |
Copy constructor; creates a copy of the given quaternion. | |
quaternion (const vector &v, double a) | |
Creates a quaternion representing a rotation around the given axis of a radians. | |
quaternion (const double w=0, const double x=0, const double y=0, const double z=0) | |
Creates a quaternion w + xi + yj + zk. | |
virtual | ~quaternion () |
Static Public Member Functions | |
static quaternion | interpolate (const quaternion &start, const quaternion &end, const double &percent) |
Public Attributes | |
double | w |
double | x |
double | y |
double | z |
quaternion | ( | const double | w = 0 , |
|
const double | x = 0 , |
|||
const double | y = 0 , |
|||
const double | z = 0 | |||
) |
Creates a quaternion w + xi + yj + zk.
Definition at line 46 of file quaternion.cpp.
Referenced by quaternion::conjugate(), quaternion::inverse(), quaternion::operator*(), and quaternion::operator+().
quaternion | ( | const vector & | v, | |
double | a | |||
) |
Creates a quaternion representing a rotation around the given axis of a radians.
Definition at line 53 of file quaternion.cpp.
References vector::get_x(), vector::get_y(), vector::get_z(), quaternion::normalize(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion | ( | const quaternion & | q | ) |
Copy constructor; creates a copy of the given quaternion.
Definition at line 66 of file quaternion.cpp.
References quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion | ( | const gsgl::string & | s | ) | [explicit] |
Intialize the quaternion from a string of numbers "x y z w"; the resulting quaternion is w + xi + yj + zk.
Definition at line 77 of file quaternion.cpp.
References vector::get_w(), vector::get_x(), vector::get_y(), vector::get_z(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion | ( | const transform & | t | ) | [explicit] |
Creates a quaternion from a rotation matrix (ignores any translation component in the transform).
Definition at line 90 of file quaternion.cpp.
~quaternion | ( | ) | [virtual] |
Definition at line 179 of file quaternion.cpp.
quaternion conjugate | ( | ) | const |
Returns the conjugate of the quaternion: w - xi - yj - zk.
Definition at line 194 of file quaternion.cpp.
References quaternion::quaternion(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
double dot | ( | const quaternion & | q | ) | const |
Definition at line 254 of file quaternion.cpp.
References quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
Referenced by quaternion::interpolate().
quaternion interpolate | ( | const quaternion & | start, | |
const quaternion & | end, | |||
const double & | percent | |||
) | [static] |
Definition at line 260 of file quaternion.cpp.
References quaternion::dot(), and quaternion::normalize().
quaternion inverse | ( | ) | const |
Returns the inverse of the quaternion: inverse / norm.
Definition at line 201 of file quaternion.cpp.
References quaternion::norm(), quaternion::quaternion(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
double norm | ( | ) | const |
Returns the norm of the quaterion: sqrt(w*w + x*x + y*y + z*z).
Definition at line 187 of file quaternion.cpp.
References quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
Referenced by quaternion::inverse(), and quaternion::normalize().
void normalize | ( | ) |
Normalizes the quaternion; sets w*w + x*x + y*y + z*z == 1.
Definition at line 213 of file quaternion.cpp.
References quaternion::norm(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
Referenced by rigid_body::compute_derived_quantities(), quaternion::interpolate(), quaternion::operator=(), and quaternion::quaternion().
quaternion operator* | ( | const double & | n | ) | const |
Definition at line 248 of file quaternion.cpp.
References quaternion::quaternion(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion operator* | ( | const quaternion & | q | ) | const |
Definition at line 239 of file quaternion.cpp.
References quaternion::quaternion(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion operator+ | ( | const quaternion & | q | ) | const |
Definition at line 233 of file quaternion.cpp.
References quaternion::quaternion(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion & operator= | ( | const transform & | t | ) |
Sets the quaternion from a rotation matrix (ignores any translation component in the transform).
Definition at line 98 of file quaternion.cpp.
References quaternion::normalize(), matrix::ptr(), quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
quaternion & operator= | ( | const quaternion & | q | ) |
Assignment operator; sets the quaternion equal to the given quaternion.
Definition at line 169 of file quaternion.cpp.
References quaternion::w, quaternion::x, quaternion::y, and quaternion::z.
double w |
Definition at line 54 of file quaternion.hpp.
Referenced by quaternion::conjugate(), quaternion::dot(), quaternion::inverse(), quaternion::norm(), quaternion::normalize(), quaternion::operator*(), quaternion::operator+(), transform::operator=(), quaternion::operator=(), and quaternion::quaternion().
double x |
Definition at line 54 of file quaternion.hpp.
Referenced by quaternion::conjugate(), quaternion::dot(), quaternion::inverse(), quaternion::norm(), quaternion::normalize(), quaternion::operator*(), quaternion::operator+(), transform::operator=(), quaternion::operator=(), and quaternion::quaternion().
double y |
Definition at line 54 of file quaternion.hpp.
Referenced by quaternion::conjugate(), quaternion::dot(), quaternion::inverse(), quaternion::norm(), quaternion::normalize(), quaternion::operator*(), quaternion::operator+(), transform::operator=(), quaternion::operator=(), and quaternion::quaternion().
double z |
Definition at line 54 of file quaternion.hpp.
Referenced by quaternion::conjugate(), quaternion::dot(), quaternion::inverse(), quaternion::norm(), quaternion::normalize(), quaternion::operator*(), quaternion::operator+(), transform::operator=(), quaternion::operator=(), and quaternion::quaternion().