#include <colvartypes.h>
Public Methods | |
quaternion (cvm::real x, cvm::real y, cvm::real z) | |
Constructor from a 3-d vector. More... | |
quaternion (cvm::real const qv[4]) | |
Constructor component by component. More... | |
quaternion (cvm::real q0i, cvm::real q1i, cvm::real q2i, cvm::real q3i) | |
Constructor component by component. More... | |
quaternion (cvm::vector1d< cvm::real > const &v) | |
void | set_from_euler_angles (cvm::real phi_in, cvm::real theta_in, cvm::real psi_in) |
"Constructor" after Euler angles (in radians) http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles. More... | |
quaternion () | |
\brief Default constructor. More... | |
void | set (cvm::real value) |
\brief Set all components to a scalar. More... | |
void | reset () |
\brief Set all components to zero (null quaternion). More... | |
void | reset_rotation () |
\brief Set the q0 component to 1 and the others to 0 (quaternion representing no rotation). More... | |
std::string | to_simple_string () const |
int | from_simple_string (std::string const &s) |
cvm::real & | operator[] (int i) |
Access the quaternion as a 4-d array (return a reference). More... | |
cvm::real | operator[] (int i) const |
Access the quaternion as a 4-d array (return a value). More... | |
cvm::vector1d< cvm::real > const | as_vector () const |
cvm::real | norm2 () const |
Square norm of the quaternion. More... | |
cvm::real | norm () const |
Norm of the quaternion. More... | |
cvm::quaternion | conjugate () const |
Return the conjugate quaternion. More... | |
void | operator *= (cvm::real a) |
void | operator/= (cvm::real a) |
void | set_positive () |
void | operator+= (cvm::quaternion const &h) |
void | operator-= (cvm::quaternion const &h) |
cvm::rvector | get_vector () const |
Return the vector component. More... | |
cvm::rvector | rotate (cvm::rvector const &v) const |
\brief Rotate v through this quaternion (put it in the rotated reference frame). More... | |
cvm::quaternion | rotate (cvm::quaternion const &Q2) const |
\brief Rotate Q2 through this quaternion (put it in the rotated reference frame). More... | |
cvm::rmatrix | rotation_matrix () const |
Return the 3x3 matrix associated to this quaternion. More... | |
cvm::quaternion | position_derivative_inner (cvm::rvector const &pos, cvm::rvector const &vec) const |
\brief Multiply the given vector by the derivative of the given (rotated) position with respect to the quaternion. More... | |
cvm::real | cosine (cvm::quaternion const &q) const |
\brief Return the cosine between the orientation frame associated to this quaternion and another. More... | |
cvm::real | dist2 (cvm::quaternion const &Q2) const |
\brief Square distance from another quaternion on the 4-dimensional unit sphere: returns the square of the angle along the shorter of the two geodesics. More... | |
cvm::quaternion | dist2_grad (cvm::quaternion const &Q2) const |
Gradient of the square distance: returns a 4-vector equivalent to that provided by slerp. More... | |
void | match (cvm::quaternion &Q2) const |
\brief Choose the closest between Q2 and -Q2 and save it back. Not required for dist2() and dist2_grad(). More... | |
cvm::real | inner (cvm::quaternion const &Q2) const |
\brief Inner product (as a 4-d vector) with Q2; requires match() if the largest overlap is looked for. More... | |
Static Public Methods | |
size_t | output_width (size_t real_width) |
Tell the number of characters required to print a quaternion, given that of a real number. More... | |
Public Attributes | |
cvm::real | q0 |
cvm::real | q1 |
cvm::real | q2 |
cvm::real | q3 |
Friends | |
std::ostream & | operator<< (std::ostream &os, cvm::quaternion const &q) |
\brief Formatted output operator. More... | |
std::istream & | operator>> (std::istream &is, cvm::quaternion &q) |
\brief Formatted input operator. More... | |
cvm::quaternion | operator+ (cvm::quaternion const &h, cvm::quaternion const &q) |
cvm::quaternion | operator- (cvm::quaternion const &h, cvm::quaternion const &q) |
cvm::quaternion | operator * (cvm::quaternion const &h, cvm::quaternion const &q) |
\brief Provides the quaternion product. NOTE: for the inner product use: `h.inner (q);`. More... | |
cvm::quaternion | operator * (cvm::real c, cvm::quaternion const &q) |
cvm::quaternion | operator * (cvm::quaternion const &q, cvm::real c) |
cvm::quaternion | operator/ (cvm::quaternion const &q, cvm::real c) |
Definition at line 937 of file colvartypes.h.
|
Constructor from a 3-d vector.
Definition at line 944 of file colvartypes.h. References z. |
|
Constructor component by component.
Definition at line 949 of file colvartypes.h. |
|
Constructor component by component.
Definition at line 954 of file colvartypes.h. |
|
Definition at line 961 of file colvartypes.h. |
|
\brief Default constructor.
Definition at line 986 of file colvartypes.h. References colvarmodule::reset. |
|
Definition at line 1060 of file colvartypes.h. References result. |
|
Return the conjugate quaternion.
Definition at line 1083 of file colvartypes.h. |
|
\brief Return the cosine between the orientation frame associated to this quaternion and another.
Definition at line 1209 of file colvartypes.h. |
|
\brief Square distance from another quaternion on the 4-dimensional unit sphere: returns the square of the angle along the shorter of the two geodesics.
Definition at line 1218 of file colvartypes.h. References colvarmodule::acos, and PI. |
|
Gradient of the square distance: returns a 4-vector equivalent to that provided by slerp.
Definition at line 1235 of file colvartypes.h. References colvarmodule::acos, colvarmodule::fabs, PI, and colvarmodule::sin. |
|
|
|
Return the vector component.
Definition at line 1117 of file colvartypes.h. |
|
\brief Inner product (as a 4-d vector) with Q2; requires match() if the largest overlap is looked for.
Definition at line 1271 of file colvartypes.h. |
|
\brief Choose the closest between Q2 and -Q2 and save it back. Not required for dist2() and dist2_grad().
Definition at line 1262 of file colvartypes.h. |
|
Norm of the quaternion.
Definition at line 1077 of file colvartypes.h. References colvarmodule::sqrt. |
|
Square norm of the quaternion.
Definition at line 1071 of file colvartypes.h. |
|
Definition at line 1088 of file colvartypes.h. |
|
Definition at line 1107 of file colvartypes.h. |
|
Definition at line 1111 of file colvartypes.h. |
|
Definition at line 1093 of file colvartypes.h. |
|
Access the quaternion as a 4-d array (return a value).
Definition at line 1043 of file colvartypes.h. References colvarmodule::error. |
|
Access the quaternion as a 4-d array (return a reference).
Definition at line 1026 of file colvartypes.h. References colvarmodule::error. |
|
Tell the number of characters required to print a quaternion, given that of a real number.
Definition at line 1012 of file colvartypes.h. |
|
\brief Multiply the given vector by the derivative of the given (rotated) position with respect to the quaternion.
|
|
\brief Set all components to zero (null quaternion).
Definition at line 998 of file colvartypes.h. |
|
\brief Set the q0 component to 1 and the others to 0 (quaternion representing no rotation).
Definition at line 1005 of file colvartypes.h. |
|
\brief Rotate Q2 through this quaternion (put it in the rotated reference frame).
Definition at line 1173 of file colvartypes.h. References rotate. |
|
\brief Rotate v through this quaternion (put it in the rotated reference frame).
Definition at line 1165 of file colvartypes.h. |
|
Return the 3x3 matrix associated to this quaternion.
Definition at line 1180 of file colvartypes.h. |
|
\brief Set all components to a scalar.
Definition at line 992 of file colvartypes.h. |
|
"Constructor" after Euler angles (in radians) http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles.
Definition at line 968 of file colvartypes.h. References colvarmodule::cos, and colvarmodule::sin. |
|
Definition at line 1098 of file colvartypes.h. |
|
|
|
Definition at line 1151 of file colvartypes.h. |
|
Definition at line 1146 of file colvartypes.h. |
|
\brief Provides the quaternion product. NOTE: for the inner product use: `h.inner (q);`.
Definition at line 1137 of file colvartypes.h. |
|
Definition at line 1123 of file colvartypes.h. |
|
Definition at line 1129 of file colvartypes.h. |
|
Definition at line 1156 of file colvartypes.h. |
|
\brief Formatted output operator.
|
|
\brief Formatted input operator.
|
|
Definition at line 941 of file colvartypes.h. Referenced by operator<<, and operator>>. |
|
Definition at line 941 of file colvartypes.h. Referenced by operator<<, and operator>>. |
|
Definition at line 941 of file colvartypes.h. Referenced by operator<<, and operator>>. |
|
Definition at line 941 of file colvartypes.h. Referenced by operator<<, and operator>>. |