|
MorphoGraphX
2.0-1-227
|
#include <Quaternion.hpp>
Inheritance diagram for mgx::Quaternion:Public Member Functions | |
| Quaternion () | |
| Default constructor. More... | |
| Quaternion (const Point4d &other) | |
| Creates a quaternion from a Point4d. More... | |
| Quaternion (double x, double y, double z, double w) | |
| Creates a quaternion specified by its components. More... | |
| Quaternion (const Quaternion &other) | |
| Copy constructor. More... | |
| Quaternion (const Point3d &axis, double angle) | |
| Creates a Quaternion corresponding to an axis rotation. More... | |
| Quaternion (const Point3d &from, const Point3d &to) | |
Creates the quaternion corresponding to the rotation transforming from into to. More... | |
| Quaternion (const Matrix3d &m) | |
Creates the quaternion corresponding to the rotation matrix m. More... | |
| Quaternion & | operator= (const Quaternion &other) |
| Assignment operator for quaternions. More... | |
| void | setAxisAngle (const Point3d &axis, double angle) |
| Set the quaternion to the described rotation. More... | |
| double & | w () |
| Accessing the real part of the quaternion. More... | |
| const double & | w () const |
| Accessing the real part of the quaternion. More... | |
| Quaternion & | operator+= (const Quaternion &other) |
| Quaternion in-place addition. More... | |
| Quaternion | operator+ (const Quaternion &other) const |
| Quaternion addition. More... | |
| Quaternion | operator* (const Quaternion &other) const |
| Quaternion multiplication. More... | |
| Quaternion & | operator*= (const Quaternion &other) |
| Quaternion in-place multiplication. More... | |
| Quaternion & | operator*= (double s) |
| In-place multiplication of a quaternion by a scalar. More... | |
| Quaternion | inverse () const |
| Return the quaternion corresponding to the inverse transform. More... | |
| Quaternion | conjugate () const |
| Return the conjugate of the current quaternion. More... | |
| Quaternion & | operator/= (double v) |
| Division of a quaternion by a real number. More... | |
| Quaternion | operator/ (double v) const |
| Division of a quaternion by a real number. More... | |
| void | setMatrix (Matrix3d &m) const |
| Fill the matrix as argument from the quaternion. More... | |
| void | setMatrix (Matrix4d &m) const |
| Fill the matrix as argument from the quaternion. More... | |
| Point3d | axis () const |
| Returns the axis of the rotation corresponding to this quaternion. More... | |
| double | angle () const |
| Returns the angle of the rotation corresponding to this quaternion. More... | |
| Point3d | rotate (const Point3d &v) const |
| Apply the rotation contained in this quaternion on the vector. More... | |
| Point3d | inverseRotate (const Point3d &v) const |
| Apply the inverse of the rotation contained in this quaternion on the vector. More... | |
Public Member Functions inherited from mgx::Vector< dim, T > | |
| template<size_t d1, class T1 > | |
| CU_HOST_DEVICE | Vector (const Vector< d1, T1 > &vec) |
| Copy another vector with different number of elements. More... | |
| template<class Vec > | |
| CU_HOST_DEVICE | Vector (const Vec &el) |
| Initialize a vector from any object behaving like an array. More... | |
| CU_HOST_DEVICE | Vector (const T &x=T()) |
Initialize a vector with all values to x. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y) |
| Initialize a 2D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y, const T &z) |
| Initialize a 3D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y, const T &z, const T &t) |
| Initialize a 4D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y, const T &z, const T &a, const T &b) |
| Initialize a 5D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y, const T &z, const T &a, const T &b, const T &c) |
| Initialize a 6D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &x, const T &y, const T &z, const T &a, const T &b, const T &c, const T &d) |
| Initialize a 7D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h) |
| Initialize a 8D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i) |
| Initialize a 9D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i, const T &j, const T &k, const T &l) |
| Initialize a 12D vector. More... | |
| CU_HOST_DEVICE | Vector (const T &a, const T &b, const T &c, const T &d, const T &e, const T &f, const T &g, const T &h, const T &i, const T &j, const T &k, const T &l, const T &m, const T &n, const T &o, const T &p, const T &q, const T &r) |
| Initialize a 18D vector. More... | |
| CU_HOST_DEVICE T * | data () |
| Returns a raw pointer on the data. More... | |
| CU_HOST_DEVICE iterator | begin () |
| STL-iteration begin. More... | |
| CU_HOST_DEVICE const_iterator | begin () const |
| Stl-iteration constant begin. More... | |
| CU_HOST_DEVICE iterator | end () |
| STL-iteration end. More... | |
| CU_HOST_DEVICE const_iterator | end () const |
| Stl-iteration constant end. More... | |
| const CU_HOST_DEVICE T * | c_data () const |
| Returns a constant raw pointer on the data. More... | |
| CU_HOST_DEVICE Vector | operator- (void) const |
| Vector negation. More... | |
| CU_HOST_DEVICE Vector | operator+ (const Vector &vec) const |
| Vector addition. More... | |
| CU_HOST_DEVICE Vector | operator- (const Vector &vec) const |
| Vector subtraction. More... | |
| CU_HOST_DEVICE Vector | mult (const Vector &vec) const |
| Element-wise multiplcation. More... | |
| CU_HOST_DEVICE Vector | operator* (const T &scalar) const |
| Multiplication by a scalar. More... | |
| CU_HOST_DEVICE Vector | operator/ (const T &scalar) const |
| Division by a scalar. More... | |
| CU_HOST_DEVICE Vector | operator/ (const Vector &vec) const |
| Element-wise division. More... | |
| CU_HOST_DEVICE Vector & | operator/= (const Vector &vec) |
| In-place element-wise division by a scalar. More... | |
| CU_HOST_DEVICE T | operator* (const Vector &vec) const |
| Dot product. More... | |
| CU_HOST_DEVICE Vector & | operator+= (const Vector &vec) |
| Vector copy. More... | |
| CU_HOST_DEVICE Vector & | operator+= (const T &val) |
| In-place constant addition. More... | |
| CU_HOST_DEVICE Vector & | operator-= (const Vector &vec) |
| In-place vector subtraction. More... | |
| CU_HOST_DEVICE Vector & | operator-= (const T &val) |
| In-place value subtraction. More... | |
| CU_HOST_DEVICE Vector & | operator*= (const T &scalar) |
| In-place multiplication by a scalar. More... | |
| template<typename T1 > | |
| CU_HOST_DEVICE Vector & | operator*= (const T1 &scalar) |
| In-place multiplication by a scalar. More... | |
| CU_HOST_DEVICE Vector & | operator/= (const T &scalar) |
| In-place division by a scalar. More... | |
| template<typename T1 > | |
| CU_HOST_DEVICE Vector & | operator/= (const T1 &scalar) |
| In-place division by a scalar. More... | |
| CU_HOST_DEVICE bool | operator== (const Vector &vec) const |
| Element-wise equality. More... | |
| CU_HOST_DEVICE bool | operator!= (const Vector &vec) const |
| Element-wise inequality. More... | |
| CU_HOST_DEVICE T & | operator[] (size_t idx) |
Access to the element idx. More... | |
| const CU_HOST_DEVICE T & | operator[] (size_t idx) const |
Access to the element idx. More... | |
| CU_HOST_DEVICE T | norm () const |
| Euclidean norm of the vector. More... | |
| CU_HOST_DEVICE T | normsq () const |
| Square of the Euclidean norm of the vector. More... | |
| CU_HOST_DEVICE Vector & | normalize (void) |
| Normalize the vector. More... | |
| CU_HOST_DEVICE Vector | normalized (void) const |
| Returns a normalized version of the vector. More... | |
| bool | iszero (void) |
| Vector & | zero (void) |
| CU_HOST_DEVICE void | set (const T &x) |
| Set the values of a 1-D vector. More... | |
| CU_HOST_DEVICE void | set (const T &x, const T &y) |
| Set the values of a 2-D vector. More... | |
| CU_HOST_DEVICE void | set (const T &x, const T &y, const T &z) |
| Set the values of a 3-D vector. More... | |
| CU_HOST_DEVICE void | set (const T &x, const T &y, const T &z, const T &t) |
| Set the values of a 4-D vector. More... | |
| CU_HOST_DEVICE Vector & | operator= (const T &value) |
Set all the elements to value. More... | |
| CU_HOST_DEVICE Vector | cross (const Vector &other) const |
Compute the cross product as this x other. More... | |
| CU_HOST_DEVICE void | x (const T &v) |
| Short access to the first element. More... | |
| CU_HOST_DEVICE void | y (const T &v) |
| Short access to the second element. More... | |
| CU_HOST_DEVICE void | z (const T &v) |
| Short access to the third element. More... | |
| CU_HOST_DEVICE void | t (const T &v) |
| Short access to the fourth element. More... | |
| CU_HOST_DEVICE T & | x () |
| Short access to the first element. More... | |
| CU_HOST_DEVICE T & | y () |
| Short access to the second element. More... | |
| CU_HOST_DEVICE T & | z () |
| Short access to the third element. More... | |
| CU_HOST_DEVICE T & | t () |
| Short access to the fourth element. More... | |
| const CU_HOST_DEVICE T & | x () const |
| Short access to the first element. More... | |
| const CU_HOST_DEVICE T & | y () const |
| Short access to the second element. More... | |
| const CU_HOST_DEVICE T & | z () const |
| Short access to the third element. More... | |
| const CU_HOST_DEVICE T & | t () const |
| Short access to the fourth element. More... | |
| CU_HOST_DEVICE void | i (const T &v) |
| Short access to the first element. More... | |
| CU_HOST_DEVICE void | j (const T &v) |
| Short access to the second element. More... | |
| CU_HOST_DEVICE void | k (const T &v) |
| Short access to the third element. More... | |
| CU_HOST_DEVICE void | l (const T &v) |
| Short access to the fourth element. More... | |
| CU_HOST_DEVICE T & | i () |
| Short access to the first element. More... | |
| CU_HOST_DEVICE T & | j () |
| Short access to the second element. More... | |
| CU_HOST_DEVICE T & | k () |
| Short access to the third element. More... | |
| CU_HOST_DEVICE T & | l () |
| Short access to the fourth element. More... | |
| const CU_HOST_DEVICE T & | i () const |
| Short access to the first element. More... | |
| const CU_HOST_DEVICE T & | j () const |
| Short access to the second element. More... | |
| const CU_HOST_DEVICE T & | k () const |
| Short access to the third element. More... | |
| const CU_HOST_DEVICE T & | l () const |
| Short access to the fourth element. More... | |
| CU_HOST_DEVICE Vector< 2, T > | projectXY (void) |
| Extract the two first elements of the vector. 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... | |
| CU_HOST_DEVICE bool | operator>= (const Vector &other) const |
| Comparison operator. More... | |
Additional Inherited Members | |
Public Types inherited from mgx::Vector< dim, T > | |
| typedef T | value_type |
| typedef T & | reference_type |
| typedef T * | pointer_type |
| typedef T * | iterator |
Static Public Member Functions inherited from mgx::Vector< dim, T > | |
| static CU_HOST_DEVICE size_t | size () |
| Returns the size of the vector (i.e. More... | |
Public Attributes inherited from mgx::Vector< dim, T > | |
| const typedef T & | const_reference_type |
| const typedef T * | const_pointer_type |
| const typedef T * | const_iterator |
Static Public Attributes inherited from mgx::Vector< dim, T > | |
| static const size_t | numElems |
Protected Attributes inherited from mgx::Vector< dim, T > | |
| T | elems [dim] |
Related Functions inherited from mgx::Vector< dim, T > | |
| template<class T > | |
| CU_HOST_DEVICE T | operator% (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Cross product v1 x v2. More... | |
| template<class T > | |
| CU_HOST_DEVICE T | operator^ (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Cross product v1 x v2 (French notation) More... | |
| template<class T > | |
| CU_HOST_DEVICE T | operator^ (const Vector< 1, T > &, const Vector< 1, T > &) |
Cross product v1 x v2 (French notation) More... | |
| template<class T > | |
| CU_HOST_DEVICE Vector< 3, T > | operator% (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Cross product v1 x v2. More... | |
| template<class T > | |
| CU_HOST_DEVICE Vector< 3, T > | operator^ (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Cross product v1 x v2 (French notation) More... | |
| template<class T > | |
| CU_HOST_DEVICE float | angle (const Vector< 2, T > &v) |
| Angle of the vector with (0,1) More... | |
| template<class T > | |
| CU_HOST_DEVICE float | angle (const Vector< 3, T > &v1, const Vector< 3, T > &v2) |
Non-oriented angle between v1 and v2. More... | |
| template<class T > | |
| CU_HOST_DEVICE float | angle (const Vector< 2, T > &v1, const Vector< 2, T > &v2) |
Oriented angle between v1 and v2. More... | |
| template<class T > | |
| CU_HOST_DEVICE float | angle (const Vector< 1, T > &v1, const Vector< 1, T > &v2) |
Oriented angle between v1 and v2. More... | |
| template<class T > | |
| CU_HOST_DEVICE float | angle (const Vector< 3, T > &v1, const Vector< 3, T > &v2, const Vector< 3, T > &ref) |
Oriented angle between v1 and v2 with ref to orient the space. More... | |
| CU_HOST_DEVICE float | normalized (float) |
| Normalized real. More... | |
| CU_HOST_DEVICE float | normsq (float s) |
| Euclidean square norm of a real. More... | |
| CU_HOST_DEVICE float | norm (float s) |
| Euclidean norm of a real. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE T | norm (const Vector< dim, T > &v) |
| Function-version of the norm. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE T | normsq (const Vector< dim, T > &v) |
| Function-version of the square norm. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | normalized (const Vector< dim, T > &v) |
| Function-version of the square norm. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | fabs (const Vector< dim, T > &v) |
| Return the vector whose component is the absolute value of the input vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | max (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Return the vector whose component is the max of the two input vectors components. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | min (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Return the vector whose component is the min of the two input vectors components. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | trim (const Vector< dim, T > &v, const Vector< dim, T > &minv, const Vector< dim, T > &maxv) |
| Return the vector with components clipped to min and max vectors. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | multiply (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Return the vector whose component is the product of the two input vectors components. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | divide (const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Return the vector whose component is the ratio of the two input vectors components. More... | |
| template<typename T > | |
| CU_HOST_DEVICE Vector< 3, T > | orthogonal (const Vector< 3, T > &v) |
| Find a vector orthogonal to v. More... | |
| template<size_t dim, typename T , typename T1 > | |
| CU_HOST_DEVICE Vector< dim, T > | map (T(*fct)(T1), const Vector< dim, T1 > &v) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | map (const T &(*fct)(const T &, const T &), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | map (T(*fct)(const T &, const T &), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | map (T(*fct)(T, T), const Vector< dim, T > &v1, const Vector< dim, T > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T , typename T1 , typename T2 > | |
| CU_HOST_DEVICE Vector< dim, T > | map (const T &(*fct)(const T1 &, const T2 &), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T , typename T1 , typename T2 > | |
| CU_HOST_DEVICE Vector< dim, T > | map (T(*fct)(const T1 &, const T2 &), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T , typename T1 , typename T2 > | |
| CU_HOST_DEVICE Vector< dim, T > | map (T(*fct)(T1, T2), const Vector< dim, T1 > &v1, const Vector< dim, T2 > &v2) |
| Map a function to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | operator+ (const Vector< dim, T > &v, const T &value) |
| Add a value to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | operator+ (const T &value, const Vector< dim, T > &v) |
| Add a value to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | operator- (const Vector< dim, T > &v, const T &value) |
| Substact a value to all elements of a vector. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim, T > | operator- (const T &value, const Vector< dim, T > &v) |
| Equivalent to substracting a vector with all component the same to another one. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim+1, T > | homogeneous (const Vector< dim, T > &v) |
| Create a homogeneous coordinate vector from a cartesian one. More... | |
| template<size_t dim, typename T > | |
| CU_HOST_DEVICE Vector< dim - 1, T > | cartesian (const Vector< dim, T > &v) |
| Extract the cartesion coordinates from a homogeneous vector. More... | |
Implements the quaternion operations
Definition at line 29 of file Quaternion.hpp.
|
inline |
Default constructor.
Provides an identity quaternion FIXME Shouldn't this be 0?
Definition at line 35 of file Quaternion.hpp.
|
inline |
Creates a quaternion from a Point4d.
Definition at line 40 of file Quaternion.hpp.
|
inline |
Creates a quaternion specified by its components.
Definition at line 45 of file Quaternion.hpp.
|
inline |
Copy constructor.
Definition at line 50 of file Quaternion.hpp.
| mgx::Quaternion::Quaternion | ( | const Point3d & | axis, |
| double | 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. |
Creates the quaternion corresponding to the rotation transforming from into to.
| mgx::Quaternion::Quaternion | ( | const Matrix3d & | m | ) |
Creates the quaternion corresponding to the rotation matrix m.
| double mgx::Quaternion::angle | ( | ) | const |
Returns the angle of the rotation corresponding to this quaternion.
| Point3d mgx::Quaternion::axis | ( | ) | const |
Returns the axis of the rotation corresponding to this quaternion.
|
inline |
Return the conjugate of the current quaternion.
Definition at line 145 of file Quaternion.hpp.
|
inline |
Return the quaternion corresponding to the inverse transform.
Definition at line 136 of file Quaternion.hpp.
| Quaternion mgx::Quaternion::operator* | ( | const Quaternion & | other | ) | const |
Quaternion multiplication.
| Quaternion& mgx::Quaternion::operator*= | ( | const Quaternion & | other | ) |
Quaternion in-place multiplication.
|
inline |
In-place multiplication of a quaternion by a scalar.
Definition at line 126 of file Quaternion.hpp.
|
inline |
Quaternion addition.
Definition at line 107 of file Quaternion.hpp.
|
inline |
Quaternion in-place addition.
Definition at line 97 of file Quaternion.hpp.
|
inline |
Division of a quaternion by a real number.
Definition at line 162 of file Quaternion.hpp.
|
inline |
Division of a quaternion by a real number.
Definition at line 152 of file Quaternion.hpp.
| Quaternion& mgx::Quaternion::operator= | ( | const Quaternion & | other | ) |
Assignment operator for quaternions.
Apply the rotation contained in this quaternion on the vector.
| void mgx::Quaternion::setAxisAngle | ( | const Point3d & | axis, |
| double | angle | ||
| ) |
Set the quaternion to the described rotation.
| axis | Axis of the rotation |
| angle | Angle of the rotation |
| void mgx::Quaternion::setMatrix | ( | Matrix3d & | 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::Quaternion::setMatrix | ( | Matrix4d & | m | ) | const |
Fill the matrix as argument from the quaternion.
Multiplying with this matrix is equivalent to performing a rotation with this quaternion.
|
inline |
Accessing the real part of the quaternion.
Definition at line 88 of file Quaternion.hpp.
|
inline |
Accessing the real part of the quaternion.
Definition at line 92 of file Quaternion.hpp.
1.8.17