MorphoGraphX
|
Implements the quaternion operations. More...
#include <Quaternion.hpp>
Public Member Functions | |
Quaternion () | |
Default constructor. More... | |
Quaternion (float x, float y, float z, float w) | |
Creates a quaternion specified by its components. | |
Quaternion (const Quaternion &other) | |
Copy constructor. | |
Quaternion (const Point3f &axis, float angle) | |
Creates a Quaternion corresponding to an axis rotation. More... | |
Quaternion (const Point3f &from, const Point3f &to) | |
Creates the quaternion corresponding to the rotation transforming from into to . | |
Quaternion (const Matrix3f &m) | |
Creates the quaternion corresponding to the rotation matrix m . | |
Quaternion & | operator= (const Quaternion &other) |
Assignment operator for quaternions. | |
void | setAxisAngle (const Point3f &axis, float angle) |
Set the quaternion to the described rotation. More... | |
float & | w () |
Accessing the real part of the quaternion. | |
const float & | w () const |
Accessing the real part of the quaternion. | |
Quaternion & | operator+= (const Quaternion &other) |
Quaternion in-place addition. | |
Quaternion | operator+ (const Quaternion &other) const |
Quaternion addition. | |
Quaternion | operator* (const Quaternion &other) const |
Quaternion multiplication. | |
Quaternion & | operator*= (const Quaternion &other) |
Quaternion in-place multiplication. | |
Quaternion & | operator*= (float s) |
In-place multiplication of a quaternion by a scalar. | |
Quaternion | inverse () const |
Return the quaternion corresponding to the inverse transform. | |
Quaternion | conjugate () const |
Return the conjugate of the current quaternion. | |
Quaternion & | operator/= (float v) |
Division of a quaternion by a real number. | |
Quaternion | operator/ (float v) const |
Division of a quaternion by a real number. | |
void | setMatrix (Matrix3f &m) const |
Fill the matrix as argument from the quaternion. More... | |
void | setMatrix (Matrix4f &m) const |
Fill the matrix as argument from the quaternion. More... | |
Point3f | axis () const |
Returns the axis of the rotation corresponding to this quaternion. | |
float | angle () const |
Returns the angle of the rotation corresponding to this quaternion. | |
Point3f | rotate (const Point3f &v) const |
Apply the rotation contained in this quaternion on the vector. | |
Point3f | inverseRotate (const Point3f &v) const |
Apply the inverse of the rotation contained in this quaternion on the vector. More... | |
![]() | |
CU_HOST_DEVICE | Vector (const Vector &vec) |
Copy another vector. | |
CU_HOST_DEVICE | Vector (const Vector< dim, T1 > &vec) |
Copy another vector with different number of elements. | |
CU_HOST_DEVICE | Vector (const Vector< d1, T1 > &vec) |
Copy another vector with different number of elements. | |
CU_HOST_DEVICE | Vector (const Vec &el) |
Initialize a vector from any object behaving like an array. More... | |
CU_HOST_DEVICE | Vector (const float &x=float()) |
Initialize a vector with all values to x . | |
CU_HOST_DEVICE | Vector (const float &x, const float &y) |
Initialize a 2D vector. | |
CU_HOST_DEVICE | Vector (const float &x, const float &y, const float &z) |
Initialize a 3D vector. | |
CU_HOST_DEVICE | Vector (const float &x, const float &y, const float &z, const float &t) |
Initialize a 4D vector. | |
CU_HOST_DEVICE | Vector (const float &x, const float &y, const float &z, const float &a, const float &b) |
Initialize a 5D vector. | |
CU_HOST_DEVICE | Vector (const float &x, const float &y, const float &z, const float &a, const float &b, const float &c) |
Initialize a 6D vector. | |
CU_HOST_DEVICE | Vector (const float &x, const float &y, const float &z, const float &a, const float &b, const float &c, const float &d) |
Initialize a 7D vector. | |
CU_HOST_DEVICE | Vector (const float &a, const float &b, const float &c, const float &d, const float &e, const float &f, const float &g, const float &h, const float &i, const float &j, const float &k, const float &l) |
Initialize a 12D vector. | |
CU_HOST_DEVICE float * | data () |
Returns a raw pointer on the data. | |
CU_HOST_DEVICE iterator | begin () |
STL-iteration begin. | |
CU_HOST_DEVICE const_iterator | begin () const |
Stl-iteration constant begin. | |
CU_HOST_DEVICE iterator | end () |
STL-iteration end. | |
CU_HOST_DEVICE const_iterator | end () const |
Stl-iteration constant end. | |
CU_HOST_DEVICE const float * | c_data () const |
Returns a constant raw pointer on the data. | |
CU_HOST_DEVICE Vector | operator- (void) const |
Vector negation. | |
CU_HOST_DEVICE Vector | operator- (const Vector &vec) const |
Vector subtraction. | |
CU_HOST_DEVICE Vector | operator+ (const Vector &vec) const |
Vector addition. | |
CU_HOST_DEVICE Vector | mult (const Vector &vec) const |
Element-wise multiplcation. | |
CU_HOST_DEVICE Vector | operator* (const float &scalar) const |
Multiplication by a scalar. | |
CU_HOST_DEVICE float | operator* (const Vector &vec) const |
Dot product. | |
CU_HOST_DEVICE Vector | operator/ (const float &scalar) const |
Division by a scalar. | |
CU_HOST_DEVICE Vector | operator/ (const Vector &vec) const |
Element-wise division. | |
CU_HOST_DEVICE Vector & | operator/= (const Vector &vec) |
In-place element-wise division by a scalar. | |
CU_HOST_DEVICE Vector & | operator/= (const float &scalar) |
In-place division by a scalar. | |
CU_HOST_DEVICE Vector & | operator/= (const T1 &scalar) |
In-place division by a scalar. | |
CU_HOST_DEVICE Vector & | operator= (const Vector &vec) |
Vector copy. | |
CU_HOST_DEVICE Vector & | operator= (const float &value) |
Set all the elements to value . | |
CU_HOST_DEVICE Vector & | operator+= (const Vector &vec) |
In-place vector addition. | |
CU_HOST_DEVICE Vector & | operator+= (const float &val) |
In-place constant addition. | |
CU_HOST_DEVICE Vector & | operator-= (const Vector &vec) |
In-place vector subtraction. | |
CU_HOST_DEVICE Vector & | operator-= (const float &val) |
In-place value subtraction. | |
CU_HOST_DEVICE Vector & | operator*= (const float &scalar) |
In-place multiplication by a scalar. | |
CU_HOST_DEVICE Vector & | operator*= (const T1 &scalar) |
In-place multiplication by a scalar. | |
CU_HOST_DEVICE bool | operator== (const Vector &vec) const |
Element-wise equality. | |
CU_HOST_DEVICE bool | operator!= (const Vector &vec) const |
Element-wise inequality. | |
CU_HOST_DEVICE float & | operator[] (size_t idx) |
Access to the element idx . | |
CU_HOST_DEVICE const float & | operator[] (size_t idx) const |
Access to the element idx . | |
CU_HOST_DEVICE float | norm () const |
Euclidean norm of the vector. | |
CU_HOST_DEVICE float | normsq () const |
Square of the Euclidean norm of the vector. | |
CU_HOST_DEVICE Vector & | normalize (void) |
Normalize the vector. | |
CU_HOST_DEVICE Vector | normalized (void) const |
Returns a normalized version of the vector. | |
bool | iszero (void) |
Vector & | zero (void) |
CU_HOST_DEVICE void | set (const float &x) |
Set the values of a 1-D vector. | |
CU_HOST_DEVICE void | set (const float &x, const float &y) |
Set the values of a 2-D vector. | |
CU_HOST_DEVICE void | set (const float &x, const float &y, const float &z) |
Set the values of a 3-D vector. | |
CU_HOST_DEVICE void | set (const float &x, const float &y, const float &z, const float &t) |
Set the values of a 4-D vector. | |
CU_HOST_DEVICE Vector | cross (const Vector &other) const |
Compute the cross product as this x other . | |
CU_HOST_DEVICE void | x (const float &v) |
Short access to the first element. | |
CU_HOST_DEVICE float & | x () |
Short access to the first element. | |
CU_HOST_DEVICE const float & | x () const |
Short access to the first element. | |
CU_HOST_DEVICE void | y (const float &v) |
Short access to the second element. | |
CU_HOST_DEVICE float & | y () |
Short access to the second element. | |
CU_HOST_DEVICE const float & | y () const |
Short access to the second element. | |
CU_HOST_DEVICE void | z (const float &v) |
Short access to the third element. | |
CU_HOST_DEVICE float & | z () |
Short access to the third element. | |
CU_HOST_DEVICE const float & | z () const |
Short access to the third element. | |
CU_HOST_DEVICE void | t (const float &v) |
Short access to the fourth element. | |
CU_HOST_DEVICE float & | t () |
Short access to the fourth element. | |
CU_HOST_DEVICE const float & | t () const |
Short access to the fourth element. | |
CU_HOST_DEVICE void | i (const float &v) |
Short access to the first element. | |
CU_HOST_DEVICE float & | i () |
Short access to the first element. | |
CU_HOST_DEVICE const float & | i () const |
Short access to the first element. | |
CU_HOST_DEVICE void | j (const float &v) |
Short access to the second element. | |
CU_HOST_DEVICE float & | j () |
Short access to the second element. | |
CU_HOST_DEVICE const float & | j () const |
Short access to the second element. | |
CU_HOST_DEVICE void | k (const float &v) |
Short access to the third element. | |
CU_HOST_DEVICE float & | k () |
Short access to the third element. | |
CU_HOST_DEVICE const float & | k () const |
Short access to the third element. | |
CU_HOST_DEVICE void | l (const float &v) |
Short access to the fourth element. | |
CU_HOST_DEVICE float & | l () |
Short access to the fourth element. | |
CU_HOST_DEVICE const float & | l () const |
Short access to the fourth element. | |
CU_HOST_DEVICE Vector< 2, float > | projectXY (void) |
Extract the two first elements of the vector. | |
CU_HOST_DEVICE bool | operator< (const Vector &other) const |
Comparison operator. More... | |
CU_HOST_DEVICE bool | operator<= (const Vector &other) const |
Comparison operator. More... | |
CU_HOST_DEVICE bool | operator> (const Vector &other) const |
Comparison operator. More... | |
CU_HOST_DEVICE bool | operator>= (const Vector &other) const |
Comparison operator. More... | |
Additional Inherited Members | |
![]() | |
typedef float | value_type |
typedef float & | reference_type |
typedef const float & | const_reference_type |
typedef float * | pointer_type |
typedef const float * | const_pointer_type |
typedef float * | iterator |
typedef const float * | const_iterator |
![]() | |
static CU_HOST_DEVICE size_t | size () |
Returns the size of the vector (i.e. More... | |
![]() | |
float | elems [dim] |
Implements the quaternion operations.
|
inline |
Default constructor.
Provides an identity quaternion
mgx::util::Quaternion::Quaternion | ( | const Point3f & | axis, |
float | angle | ||
) |
Creates a Quaternion corresponding to an axis rotation.
axis | Axis of the rotation. It needs not be normalized before hand. If it is null, then the Quaternion will correspond to the identity matrix. |
angle | Angle of the rotation. |
void mgx::util::Quaternion::setAxisAngle | ( | const Point3f & | axis, |
float | angle | ||
) |
Set the quaternion to the described rotation.
axis | Axis of the rotation |
angle | Angle of the rotation |
void mgx::util::Quaternion::setMatrix | ( | Matrix3f & | m | ) | const |
Fill the matrix as argument from the quaternion.
Multiplying with this matrix is equivalent to performing a rotation with this quaternion.
void mgx::util::Quaternion::setMatrix | ( | Matrix4f & | m | ) | const |
Fill the matrix as argument from the quaternion.
Multiplying with this matrix is equivalent to performing a rotation with this quaternion.