Quaternion class. More...
Public Member Functions | |
quaternion () | |
default constructor | |
quaternion (const v3 &axis, const double &angle) | |
constructor from axis and angle | |
quaternion (const v4 &entries) | |
direct constructor | |
v3 | axis () const |
get the unit axis corresponding to the quaternion | |
double | angle () const |
get the angle corresponding to the quaternion | |
matrix3 | matrix () const |
compute the rotation matrix associated to the current quaternion | |
quaternion | conjugated () const |
get the conjugate of the current quaterion | |
void | compute_w () |
compute w value such that we have a unit quaternion | |
quaternion & | operator*= (const quaternion &q1) |
internal multiplication between quaternion | |
quaternion | operator- () const |
opposite | |
Static Public Member Functions | |
static quaternion | slerp (const quaternion &q0, const quaternion &q1, const double &t) |
Spherical Linear Interpolation SLERP. | |
Friends | |
quaternion | operator* (const quaternion &q0, const quaternion &q1) |
multiplication between quaternion | |
v3 | operator* (const quaternion &q, const v3 &v) |
multiplication with a vector |
Quaternion class.
cpe::quaternion::quaternion | ( | ) |
default constructor
Referenced by conjugated(), and operator-().
cpe::quaternion::quaternion | ( | const v3 & | axis, | |
const double & | angle | |||
) |
constructor from axis and angle
References cpe::v3::normalized(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
cpe::quaternion::quaternion | ( | const v4 & | entries | ) |
direct constructor
double cpe::quaternion::angle | ( | ) | const |
get the angle corresponding to the quaternion
References cpe::v4::w().
v3 cpe::quaternion::axis | ( | ) | const |
get the unit axis corresponding to the quaternion
References cpe::v3::normalized(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
void cpe::quaternion::compute_w | ( | ) |
compute w value such that we have a unit quaternion
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Referenced by Animation::load().
quaternion cpe::quaternion::conjugated | ( | ) | const |
get the conjugate of the current quaterion
References quaternion(), cpe::v4::v4(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Referenced by cpe::trackball::apply_rotation(), and cpe::navigator_tool::camera_orientation().
matrix3 cpe::quaternion::matrix | ( | ) | const |
compute the rotation matrix associated to the current quaternion
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Referenced by cpe::navigator_tool::camera_orientation().
quaternion & cpe::quaternion::operator*= | ( | const quaternion & | q1 | ) |
internal multiplication between quaternion
References cpe::v3::cross(), cpe::v3::dot(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
quaternion cpe::quaternion::operator- | ( | ) | const |
opposite
Reimplemented from cpe::v4.
References quaternion(), cpe::v4::v4(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
quaternion cpe::quaternion::slerp | ( | const quaternion & | q0, | |
const quaternion & | q1, | |||
const double & | t | |||
) | [static] |
Spherical Linear Interpolation SLERP.
Use (sin((1-t) theta )q0 +sin(t theta)q1)/sin(theta) But same results with (q1 q0^{-1})^{t} q0 (q1*q0.invert()).pow_q(t)*q0)
References cpe::v4::dot(), and cpe::v4::norm().
v3 operator* | ( | const quaternion & | q, | |
const v3 & | v | |||
) | [friend] |
multiplication with a vector
quaternion operator* | ( | const quaternion & | q0, | |
const quaternion & | q1 | |||
) | [friend] |
multiplication between quaternion