Geogram
Version 1.9.1-rc
A programming library of geometric algorithms
|
Quaternions are useful for representing rotations. More...
#include <geogram/basic/quaternion.h>
Public Member Functions | |
Quaternion () | |
Constructs a new Quaternion. | |
Quaternion (const Quaternion &rhs) | |
Copy-constructs a new Quaternion. More... | |
Quaternion (double x, double y, double z, double w) | |
Constructs a new quaternion from its coefficients. More... | |
Quaternion (const vec3 &v, double s) | |
Constructs a new Quaternion from a vector and a scalar. More... | |
Quaternion & | operator= (const Quaternion &q) |
Copies a Quaternion. More... | |
void | set (const vec3 &v, double s) |
Sets the coefficients of this quaterion. More... | |
void | print (std::ostream &out) const |
Displays this Quaternion. More... | |
mat4 | to_matrix () const |
Converts this Quaternion into a matrix. More... | |
void | set_angle (double f) |
Sets the rotation angle. More... | |
void | scale_angle (double f) |
Scales the rotation angle. | |
double | angle () const |
Gets the rotation angle. More... | |
vec3 | axis () const |
Gets the axis. More... | |
const vec3 & | v () const |
Gets the vector component. More... | |
double | s () const |
Gets the scalar component. More... | |
Static Public Member Functions | |
static Quaternion | spherical_interpolation (const Quaternion &from, const Quaternion &to, double t) |
Computes the interpolation between two quaternions. More... | |
Quaternions are useful for representing rotations.
This class is inspired by an implementation written by Paul Rademacher, in his glui library.
Definition at line 61 of file quaternion.h.
|
inline |
Copy-constructs a new Quaternion.
[in] | rhs | the Quaternion to be copied. |
Definition at line 74 of file quaternion.h.
|
inline |
Constructs a new quaternion from its coefficients.
[in] | x | a coefficient of the quaternion |
[in] | y | a coefficient of the quaternion |
[in] | z | a coefficient of the quaternion |
[in] | w | a coefficient of the quaternion |
Definition at line 84 of file quaternion.h.
|
inline |
Constructs a new Quaternion from a vector and a scalar.
[in] | v | a const reference to the vector |
[in] | s | the scalalr |
Definition at line 95 of file quaternion.h.
|
inline |
vec3 GEO::Quaternion::axis | ( | ) | const |
Gets the axis.
|
inline |
Copies a Quaternion.
[in] | q | the Quaternion to be copied |
Definition at line 103 of file quaternion.h.
|
inline |
Displays this Quaternion.
[in] | out | a reference to the std::ostream where this Quaternion should be displayed |
Definition at line 124 of file quaternion.h.
|
inline |
Gets the scalar component.
Definition at line 195 of file quaternion.h.
|
inline |
Sets the coefficients of this quaterion.
[in] | v | a const reference to the vector components |
[in] | s | the scalar component |
Definition at line 114 of file quaternion.h.
|
inline |
Sets the rotation angle.
[in] | f | the rotation angle |
Definition at line 139 of file quaternion.h.
|
static |
Computes the interpolation between two quaternions.
[in] | from | a const reference to the first quaternion |
[in] | to | a const reference to the second quaternion |
[in] | t | time, in [0.0,1.0] |
from
and to
parameterized by t
mat4 GEO::Quaternion::to_matrix | ( | ) | const |
Converts this Quaternion into a matrix.
|
inline |
Gets the vector component.
Definition at line 185 of file quaternion.h.