Quaternion class. More...
Inheritance diagram for cpe::quaternion:
Collaboration diagram for cpe::quaternion:Public Member Functions | |
| quaternion () | |
| default constructor | |
| quaternion (const v3 &axis, const double &angle) | |
| constructor from axis and angle | |
| quaternion (const v4 &v) | |
| direct constructor | |
| quaternion (const double &x, const double &y, const double &z, const double &w) | |
| 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 | |
| v3 | rotate (const v3 &vec) const |
| apply a rotation (encoded by the quaternion) to the vector/point 3D | |
| quaternion & | operator*= (const quaternion &q) |
| internal multiplication by other quaternion | |
| quaternion & | operator*= (const double &s) |
| internal multiplication by a scalar | |
| quaternion & | operator+= (const quaternion &q) |
| internal addition with other quaternion | |
| quaternion & | operator-= (const quaternion &q) |
| internal substraction with other quaternion | |
| quaternion & | operator/= (const double &s) |
| internal division by a scalar | |
| quaternion | operator* (const quaternion &q) const |
| multiplication by other quaternion | |
| quaternion | operator* (const v3 &v) const |
| multiplication with a v3 seen as a quaternion (v.w()=0) | |
| quaternion | operator* (const double &s) const |
| multiplication with scalar | |
| quaternion | operator+ (const quaternion &q) const |
| addition with other quaternionn | |
| quaternion | operator- (const quaternion &q) const |
| substraction with other quaternionn | |
| quaternion | operator/ (const double &s) const |
| division by a scalar | |
| quaternion | operator- () const |
| unary negation | |
Public Member Functions inherited from cpe::v4 | |
| v4 () | |
| empty constructor | |
| v4 (const double &x, const double &y, const double &z, const double &w) | |
| direct constructor | |
| const double & | x () const |
| get x coordinate | |
| double & | x () |
| get x coordinate | |
| const double & | y () const |
| get y coordinate | |
| double & | y () |
| get y coordinate | |
| const double & | z () const |
| get z coordinate | |
| double & | z () |
| get z coordinate | |
| const double & | w () const |
| get w coordinate | |
| double & | w () |
| get w coordinate | |
| const double & | operator[] (const size_t &k) const |
| Access to the k_th entry (k in [0,3]) | |
| double & | operator[] (const size_t &k) |
| Access to the k_th entry (k in [0,3]) | |
| const double & | operator() (const size_t &k) const |
| Access to the k_th entry (k in [0,3]) | |
| double & | operator() (const size_t &k) |
| Access to the k_th entry (k in [0,3]) | |
| void | set_zero () |
| set every entry to 0 | |
| v3 | to_v3 () const |
| convert to v3 (x,y,z) | |
| v2 | to_v2 () const |
| convert to v2 (x,y) | |
| double | dot (const v4 &p) const |
| perform dot product between two v4 | |
| double | norm () const |
| get the norm of the vector | |
| double | norm2 () const |
| get the square norm of the vector | |
| v4 | normalized () const |
| normalize the vector to unit length | |
| v4 | operator+ (const v4 &p2) const |
| |
| v4 | operator+ (const double &s) const |
| |
| v4 | operator- (const v4 &p2) const |
| |
| v4 | operator- (const double &s) const |
| |
| v4 | operator* (const double &s) const |
| multiply by a scalar operator | |
| v4 | operator/ (const double &s) const |
| divide by a scalar operator | |
| v4 & | operator+= (const v4 &p) |
| internal + | |
| v4 & | operator+= (const double &s) |
| internal + | |
| v4 & | operator-= (const v4 &p) |
| internal - | |
| v4 & | operator-= (const double &s) |
| internal - | |
| v4 & | operator*= (const double &s) |
| internal * | |
| v4 & | operator/= (const double &s) |
| internal / | |
| v4 | operator- () const |
| unary negation | |
| v4 | product_compontentwise (const v4 &p) const |
| does componentwise mutliplication | |
| v4 & | product_compontentwise_internal (const v4 &p) |
| does componentwise mutliplication | |
| void | scale (const double &sx, const double &sy, const double &sz, const double &sw) |
| internal scaling (similar to componentwise) | |
| std::string | to_string () const |
| export the value as string cout<<v4(2,3,6,7) => 2 3 6 7 | |
Static Public Member Functions | |
| static quaternion | slerp (const quaternion &q0, const quaternion &q1, const double alpha) |
| Spherical Linear Interpolation SLERP. | |
Quaternion class.
| cpe::quaternion::quaternion | ( | ) |
default constructor
Referenced by conjugated(), operator*(), operator*=(), and operator-().
Here is the caller graph for this function:| 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().
Here is the call graph for this function:| cpe::quaternion::quaternion | ( | const v4 & | v | ) |
direct constructor
| cpe::quaternion::quaternion | ( | const double & | x, |
| const double & | y, | ||
| const double & | z, | ||
| const double & | w | ||
| ) |
direct constructor
| double cpe::quaternion::angle | ( | ) | const |
get the angle corresponding to the quaternion
References cpe::v4::w().
Here is the call graph for this function:| 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().
Here is the call graph for this function:| 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().
Here is the call graph for this function:| 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().
Here is the call graph for this function:| quaternion cpe::quaternion::operator* | ( | const quaternion & | q | ) | const |
multiplication by other quaternion
| quaternion cpe::quaternion::operator* | ( | const v3 & | v | ) | const |
multiplication with a v3 seen as a quaternion (v.w()=0)
References quaternion(), cpe::v4::w(), cpe::v3::x(), cpe::v4::x(), cpe::v3::y(), cpe::v4::y(), cpe::v3::z(), and cpe::v4::z().
Here is the call graph for this function:| quaternion cpe::quaternion::operator* | ( | const double & | s | ) | const |
multiplication with scalar
| quaternion & cpe::quaternion::operator*= | ( | const quaternion & | q | ) |
internal multiplication by other quaternion
References quaternion(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:| quaternion & cpe::quaternion::operator*= | ( | const double & | s | ) |
internal multiplication by a scalar
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:| quaternion cpe::quaternion::operator+ | ( | const quaternion & | q | ) | const |
addition with other quaternionn
| quaternion & cpe::quaternion::operator+= | ( | const quaternion & | q | ) |
internal addition with other quaternion
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:| quaternion cpe::quaternion::operator- | ( | const quaternion & | q | ) | const |
substraction with other quaternionn
| quaternion cpe::quaternion::operator- | ( | ) | const |
unary negation
References quaternion(), cpe::v4::v4(), cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:| quaternion & cpe::quaternion::operator-= | ( | const quaternion & | q | ) |
internal substraction with other quaternion
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:| quaternion cpe::quaternion::operator/ | ( | const double & | s | ) | const |
division by a scalar
| quaternion & cpe::quaternion::operator/= | ( | const double & | s | ) |
internal division by a scalar
References cpe::v4::w(), cpe::v4::x(), cpe::v4::y(), and cpe::v4::z().
Here is the call graph for this function:apply a rotation (encoded by the quaternion) to the vector/point 3D
References cpe::v4::w(), cpe::v3::x(), cpe::v4::x(), cpe::v3::y(), cpe::v4::y(), cpe::v3::z(), and cpe::v4::z().
Here is the call graph for this function:
|
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().
Here is the call graph for this function: