|
OpenMD 3.2
Molecular Dynamics in the Open
|
Quaternion is a sort of a higher-level complex number. More...
#include "math/Quaternion.hpp"
Public Member Functions | |
| Quaternion (Real w, Real x, Real y, Real z) | |
| Constructs and initializes a Quaternion from w, x, y, z values. | |
| Quaternion (const Vector< Real, 4 > &v) | |
| Constructs and initializes a Quaternion from a Vector<Real,4>. | |
| Quaternion & | operator= (const Vector< Real, 4 > &v) |
| copy assignment | |
| Real | w () const |
| Returns the value of the first element of this quaternion. | |
| Real & | w () |
| Returns the reference of the first element of this quaternion. | |
| Real | x () const |
| Returns the value of the first element of this quaternion. | |
| Real & | x () |
| Returns the reference of the second element of this quaternion. | |
| Real | y () const |
| Returns the value of the thirf element of this quaternion. | |
| Real & | y () |
| Returns the reference of the third element of this quaternion. | |
| Real | z () const |
| Returns the value of the fourth element of this quaternion. | |
| Real & | z () |
| Returns the reference of the fourth element of this quaternion. | |
| bool | operator== (const Quaternion< Real > &q) |
| Tests if this quaternion is equal to other quaternion. | |
| Quaternion< Real > | inverse () |
| Returns the inverse of this quaternion. | |
| void | mul (const Quaternion< Real > &q) |
| Sets the value to the multiplication of itself and another quaternion. | |
| void | mul (const Real &s) |
| void | div (Quaternion< Real > &q) |
| Set the value of this quaternion to the division of itself by another quaternion. | |
| void | div (const Real &s) |
| Quaternion< Real > & | operator*= (const Quaternion< Real > &q) |
| Quaternion< Real > & | operator*= (const Real &s) |
| Quaternion< Real > & | operator/= (Quaternion< Real > &q) |
| Quaternion< Real > & | operator/= (const Real &s) |
| Quaternion< Real > | conjugate () const |
| Returns the conjugate quaternion of this quaternion. | |
| Real | get_rotation_angle () const |
| return rotation angle from -PI to PI | |
| Quaternion< Real > | fromAxisAngle (const Vector3< Real > &axis, const Real &angle) |
| create a unit quaternion from axis angle representation | |
| void | toAxisAngle (Vector3< Real > &axis, Real &angle) const |
| convert a quaternion to axis angle representation, preserve the axis direction and angle from -PI to +PI | |
| Quaternion< Real > | fromShortestArc (const Vector3d &from, const Vector3d &to) |
| shortest arc quaternion rotate one vector to another by shortest path. | |
| Real | ComputeTwist (const Quaternion &q) |
| void | RemoveTwist (Quaternion &q) |
| void | getTwistSwingAxisAngle (Real &twistAngle, Real &swingAngle, Vector3< Real > &swingAxis) |
| Vector3< Real > | rotate (const Vector3< Real > &v) |
| Quaternion< Real > & | align (const Vector3< Real > &V1, const Vector3< Real > &V2) |
| void | toTwistSwing (Real &tw, Real &sx, Real &sy) |
| void | toSwingTwist (Real &sx, Real &sy, Real &tw) |
| SquareMatrix< Real, 3 > | toRotationMatrix3 () |
| Returns the corresponding rotation matrix (3x3). | |
| Public Member Functions inherited from OpenMD::Vector< Real, 4 > | |
| Vector () | |
| default constructor | |
| Vector< Real, Dim > & | operator= (const Vector< Real, Dim > &v) |
| copy assignment operator | |
| Real & | operator[] (unsigned int i) |
| Returns reference of ith element. | |
| Real & | operator() (unsigned int i) |
| Returns reference of ith element. | |
| void | getArray (Real *array) const |
| Copy the internal data to an array. | |
| const Real * | getArrayPointer () const |
| Returns the pointer of internal array. | |
| bool | operator== (const Vector< Real, Dim > &v) |
| Tests if this vetor is equal to other vector. | |
| bool | operator!= (const Vector< Real, Dim > &v) |
| Tests if this vetor is not equal to other vector. | |
| void | zero () |
| Zeros out the values in this vector in place. | |
| void | negate () |
| Negates the value of this vector in place. | |
| void | add (const Vector< Real, Dim > &v1) |
| Sets the value of this vector to the sum of itself and v1 (*this += v1). | |
| void | sub (const Vector< Real, Dim > &v1) |
| Sets the value of this vector to the difference of itself and v1 (*this -= v1). | |
| void | mul (Real s) |
| Sets the value of this vector to the scalar multiplication of itself (*this *= s). | |
| void | Vmul (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2) |
| Sets the elements of this vector to the multiplication of elements of two other vectors. | |
| Vector< Real, Dim > & | abs () |
| Real | max () const |
| void | div (Real s) |
| Sets the value of this vector to the scalar division of itself (*this /= s ). | |
| void | Vdiv (const Vector< Real, Dim > &v1, const Vector< Real, Dim > &v2) |
| Sets the elements of this vector to the division of elements of two other vectors. | |
| Vector< Real, Dim > & | operator+= (const Vector< Real, Dim > &v1) |
| Vector< Real, Dim > & | operator-= (const Vector< Real, Dim > &v1) |
| Vector< Real, Dim > & | operator*= (Real s) |
| Vector< Real, Dim > & | operator/= (Real s) |
| Real | sum () const |
| Returns the sum of all elements of this vector. | |
| Real | componentProduct () const |
| Returns the product of all elements of this vector. | |
| Real | length () const |
| Returns the length of this vector. | |
| Real | lengthSquare () const |
| Returns the squared length of this vector. | |
| void | normalize () |
| Normalizes this vector in place. | |
| bool | isNormalized () const |
| Tests if this vector is normalized. | |
| unsigned int | size () const |
Additional Inherited Members | |
| Public Types inherited from OpenMD::Vector< Real, 4 > | |
| using | ElemType |
| using | ElemPoinerType |
| Protected Attributes inherited from OpenMD::Vector< Real, 4 > | |
| Real | data_ [Dim] |
Quaternion is a sort of a higher-level complex number.
It is defined as \(Q = w + x*i + y*j + z*k\), where w, x, y, and z are numbers of type T (e.g. RealType), and \(i*i = -1\); \(j*j = -1\); \(k*k = -1\); \(i*j = k\); \(j*k = i\); \(k*i = j\);
Definition at line 79 of file Quaternion.hpp.
|
inline |
Definition at line 81 of file Quaternion.hpp.
|
inline |
Constructs and initializes a Quaternion from w, x, y, z values.
Definition at line 84 of file Quaternion.hpp.
|
inline |
Constructs and initializes a Quaternion from a Vector<Real,4>.
Definition at line 92 of file Quaternion.hpp.
|
inline |
Definition at line 363 of file Quaternion.hpp.
|
inline |
Definition at line 315 of file Quaternion.hpp.
|
inline |
Returns the conjugate quaternion of this quaternion.
Definition at line 239 of file Quaternion.hpp.
|
inline |
Definition at line 209 of file Quaternion.hpp.
|
inline |
Set the value of this quaternion to the division of itself by another quaternion.
Definition at line 207 of file Quaternion.hpp.
|
inline |
create a unit quaternion from axis angle representation
Definition at line 256 of file Quaternion.hpp.
|
inline |
shortest arc quaternion rotate one vector to another by shortest path.
create rotation from -> to, for any length vectors.
Definition at line 293 of file Quaternion.hpp.
|
inline |
return rotation angle from -PI to PI
Definition at line 246 of file Quaternion.hpp.
|
inline |
Definition at line 326 of file Quaternion.hpp.
|
inline |
Returns the inverse of this quaternion.
Definition at line 169 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::div(), OpenMD::operator/(), and OpenMD::operator/().
|
inline |
Sets the value to the multiplication of itself and another quaternion.
| q | the other quaternion |
Definition at line 185 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::div(), OpenMD::operator*(), and OpenMD::operator*().
|
inline |
Definition at line 198 of file Quaternion.hpp.
|
inline |
Definition at line 216 of file Quaternion.hpp.
|
inline |
Definition at line 221 of file Quaternion.hpp.
|
inline |
Definition at line 231 of file Quaternion.hpp.
|
inline |
Definition at line 226 of file Quaternion.hpp.
|
inline |
copy assignment
Definition at line 95 of file Quaternion.hpp.
|
inline |
Tests if this quaternion is equal to other quaternion.
| q | quaternion to be compared |
Definition at line 155 of file Quaternion.hpp.
|
inline |
Definition at line 319 of file Quaternion.hpp.
|
inline |
Definition at line 350 of file Quaternion.hpp.
|
inline |
convert a quaternion to axis angle representation, preserve the axis direction and angle from -PI to +PI
Definition at line 271 of file Quaternion.hpp.
|
inline |
Returns the corresponding rotation matrix (3x3).
Definition at line 525 of file Quaternion.hpp.
Referenced by OpenMD::SquareMatrix3< RealType >::setupRotMat().
|
inline |
Definition at line 485 of file Quaternion.hpp.
|
inline |
Definition at line 421 of file Quaternion.hpp.
|
inline |
Returns the reference of the first element of this quaternion.
Definition at line 113 of file Quaternion.hpp.
|
inline |
Returns the value of the first element of this quaternion.
Definition at line 107 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::conjugate(), OpenMD::Quaternion< RealType >::fromShortestArc(), OpenMD::Quaternion< RealType >::get_rotation_angle(), OpenMD::Quaternion< RealType >::inverse(), OpenMD::SquareMatrix3< RealType >::setupRotMat(), OpenMD::Quaternion< RealType >::toAxisAngle(), and OpenMD::Quaternion< RealType >::toRotationMatrix3().
|
inline |
Returns the reference of the second element of this quaternion.
Definition at line 125 of file Quaternion.hpp.
|
inline |
Returns the value of the first element of this quaternion.
Definition at line 119 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::conjugate(), OpenMD::Quaternion< RealType >::get_rotation_angle(), OpenMD::Quaternion< RealType >::inverse(), OpenMD::SquareMatrix3< RealType >::setupRotMat(), OpenMD::Quaternion< RealType >::toAxisAngle(), and OpenMD::Quaternion< RealType >::toRotationMatrix3().
|
inline |
Returns the reference of the third element of this quaternion.
Definition at line 137 of file Quaternion.hpp.
|
inline |
Returns the value of the thirf element of this quaternion.
Definition at line 131 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::conjugate(), OpenMD::Quaternion< RealType >::get_rotation_angle(), OpenMD::Quaternion< RealType >::inverse(), OpenMD::SquareMatrix3< RealType >::setupRotMat(), OpenMD::Quaternion< RealType >::toAxisAngle(), and OpenMD::Quaternion< RealType >::toRotationMatrix3().
|
inline |
Returns the reference of the fourth element of this quaternion.
Definition at line 148 of file Quaternion.hpp.
|
inline |
Returns the value of the fourth element of this quaternion.
Definition at line 143 of file Quaternion.hpp.
Referenced by OpenMD::Quaternion< RealType >::conjugate(), OpenMD::Quaternion< RealType >::get_rotation_angle(), OpenMD::Quaternion< RealType >::inverse(), OpenMD::SquareMatrix3< RealType >::setupRotMat(), OpenMD::Quaternion< RealType >::toAxisAngle(), and OpenMD::Quaternion< RealType >::toRotationMatrix3().