|
MULTIBODY SIMULATION SOFTWARE - API documentation |
#include <CHquaternion.h>
Public Member Functions | |
| ChQuaternion (const Real ne0, const Real ne1, const Real ne2, const Real ne3) | |
| ChQuaternion (const Real ns, const ChVector< Real > nv) | |
| ChQuaternion (const ChQuaternion< Real > &other) | |
| ChQuaternion< Real > & | operator= (const ChQuaternion< Real > &other) |
| ChQuaternion< Real > | operator- () const |
| ChQuaternion< Real > | operator! () const |
| ChQuaternion< Real > | operator+ (const ChQuaternion< Real > &other) const |
| ChQuaternion< Real > & | operator+= (const ChQuaternion< Real > &other) |
| ChQuaternion< Real > | operator- (const ChQuaternion< Real > &other) const |
| ChQuaternion< Real > & | operator-= (const ChQuaternion< Real > &other) |
| ChQuaternion< Real > | operator * (const ChQuaternion< Real > &other) const |
| ChQuaternion< Real > & | operator *= (const ChQuaternion< Real > &other) |
| ChQuaternion< Real > | operator * (const Real v) const |
| ChQuaternion< Real > & | operator *= (const Real v) |
| ChQuaternion< Real > | operator/ (const ChQuaternion< Real > &other) const |
| ChQuaternion< Real > & | operator/= (const ChQuaternion< Real > &other) |
| ChQuaternion< Real > | operator/ (const Real v) const |
| ChQuaternion< Real > & | operator/= (const Real v) |
| ChQuaternion< Real > | operator% (const ChQuaternion< Real > &other) const |
| ChQuaternion< Real > & | operator%= (const ChQuaternion< Real > &other) const |
| double | operator^ (const ChQuaternion< Real > &other) const |
| bool | operator<= (const ChQuaternion< Real > &other) const |
| bool | operator>= (const ChQuaternion< Real > &other) const |
| bool | operator== (const ChQuaternion< Real > &other) const |
| bool | operator!= (const ChQuaternion< Real > &other) const |
| void | Set (const Real ne0, const Real ne1, const Real ne2, const Real ne3) |
| void | Set (const ChQuaternion< Real > &n) |
| void | Set (const Real p) |
| void | SetNull () |
| void | SetUnit () |
| void | SetScalar (const Real s) |
| void | SetVector (const ChVector< Real > &mv) |
| ChVector< Real > | GetVector () |
| bool | Equals (const ChQuaternion< Real > &other) const |
| bool | Equals (const ChQuaternion< Real > &other, Real tol) const |
| void | Add (const ChQuaternion< Real > A, const ChQuaternion< Real > B) |
| void | Sub (const ChQuaternion< Real > A, const ChQuaternion< Real > B) |
| void | Cross (const ChQuaternion< Real > qa, const ChQuaternion< Real > qb) |
| double | Dot (const ChQuaternion< Real > A, const ChQuaternion< Real > B) |
| void | Mul (const ChQuaternion< Real > A, const Real v) |
| void | Scale (const Real v) |
| double | Length () |
| double | Length2 () |
| double | LengthInf () |
| bool | Normalize () |
| void | Conjugate (const ChQuaternion< Real > &A) |
| void | Conjugate () |
| ChQuaternion< Real > | GetConjugate () const |
| ChVector< Real > | Rotate (const ChVector< Real > A) const |
| ChVector< Real > | RotateBack (const ChVector< Real > A) const |
| void | Q_from_AngAxis (const double angle, const ChVector< Real > axis) |
| void | Q_from_AngX (const double angleX) |
| void | Q_from_AngY (const double angleY) |
| void | Q_from_AngZ (const double angleZ) |
| void | Q_to_AngAxis (double &a_angle, ChVector< Real > &a_axis) |
| void | Q_from_NasaAngles (const ChVector< Real > mang) |
| ChVector< Real > | Q_to_NasaAngles () |
| void | Qdt_from_Wabs (const ChVector< Real > w, const ChQuaternion< Real > q) |
| void | Qdt_from_Wrel (const ChVector< Real > w, const ChQuaternion< Real > q) |
| void | Qdt_to_Wabs (ChVector< Real > w, const ChQuaternion< Real > q) |
| void | Qdt_to_Wrel (ChVector< Real > w, const ChQuaternion< Real > q) |
| void | Qdtdt_from_Aabs (const ChVector< Real > a, const ChQuaternion< Real > q, const ChQuaternion< Real > q_dt) |
| void | Qdtdt_from_Arel (const ChVector< Real > a, const ChQuaternion< Real > q, const ChQuaternion< Real > q_dt) |
| void | Qdt_from_AngAxis (const ChQuaternion< Real > q, const double angle_dt, const ChVector< Real > axis) |
| void | Qdtdt_from_AngAxis (const ChQuaternion< Real > q, const ChQuaternion< Real > q_dt, const double angle_dtdt, const ChVector< Real > axis) |
| void | ImmQ_complete (const ChVector< Real > &qimm) |
| void | ImmQ_dt_complete (const ChQuaternion< Real > &mq, const ChVector< Real > &qimm_dt) |
| void | ImmQ_dtdt_complete (const ChQuaternion< Real > &mq, const ChQuaternion< Real > &mqdt, const ChVector< Real > &qimm_dtdt) |
| ChVector< Real > | GetXaxis () |
| void | StreamOUT (ChStreamOutAscii &mstream) |
| void | StreamOUT (ChStreamOutBinary &mstream) |
| void | StreamIN (ChStreamInBinary &mstream) |
Public Attributes | |
| Real | e0 |
| Real | e1 |
| Real | e2 |
| Real | e3 |
Class defining quaternion objects, that is four-dimensional numbers, also known as Eulero's parameters. Quaternions are very handy when used to represent rotations in 3d.
The quaternion object comes either with the template "ChQuaternion<type>" mode, either in the 'shortcut' flavour, that is "Quaternion", which assumes the type of the four scalars is double precision, so it is faster to type. For example, for a declaration, you can write "ChQuaternion<double> foo;", as well as "Quaternion foo;" (less typing effort for the second..)
| chrono::ChQuaternion< Real >::ChQuaternion | ( | const ChQuaternion< Real > & | other | ) |
Copy constructor.
| ChQuaternion<Real>& chrono::ChQuaternion< Real >::operator= | ( | const ChQuaternion< Real > & | other | ) |
Assignment operator: copy from another quaternion.
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator- | ( | ) | const |
Operator for sign change.
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator! | ( | ) | const |
Operator for making a conjugate quaternion (the original is not changed) A conjugate quaternion has the vectorial part with changed sign
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator+ | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for quaternion sum.
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator- | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for quaternion difference.
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator * | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for element-wise multiplication (note that this is neither dot product nor quaternion product! Quaternion product is % operator!)
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator/ | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for element-wise division (note that this is NOT the quaternion division operation!)
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator/ | ( | const Real | v | ) | const |
Operator for scaling the quaternion by inverse of a scalar value, as q/s.
| ChQuaternion<Real> chrono::ChQuaternion< Real >::operator% | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for quaternion product: AB means the typical quaternion product AxB Note: pay attention to operator low precedence (see C++ precedence rules!)
| double chrono::ChQuaternion< Real >::operator^ | ( | const ChQuaternion< Real > & | other | ) | const |
Operator for dot product: A^B means the scalar dot-product A*B Note: pay attention to operator low precedence (see C++ precedence rules!)
| void chrono::ChQuaternion< Real >::Set | ( | const Real | ne0, | |
| const Real | ne1, | |||
| const Real | ne2, | |||
| const Real | ne3 | |||
| ) |
Sets the four values of the quaternion at once.
| void chrono::ChQuaternion< Real >::Set | ( | const ChQuaternion< Real > & | n | ) |
Sets the quaternion as a copy of another quaternion.
| void chrono::ChQuaternion< Real >::Set | ( | const Real | p | ) |
Sets the quaternion with four components as a sample scalar.
| void chrono::ChQuaternion< Real >::SetNull | ( | ) |
Sets the quaternion as a null quaternion.
| void chrono::ChQuaternion< Real >::SetUnit | ( | ) |
Sets the quaternion as a unit quaternion.
| void chrono::ChQuaternion< Real >::SetScalar | ( | const Real | s | ) |
Sets the scalar part only.
| void chrono::ChQuaternion< Real >::SetVector | ( | const ChVector< Real > & | mv | ) |
Sets the vectorial part only.
| ChVector<Real> chrono::ChQuaternion< Real >::GetVector | ( | ) |
Gets the vectorial part only.
| bool chrono::ChQuaternion< Real >::Equals | ( | const ChQuaternion< Real > & | other | ) | const |
Returns true if quaternion is identical to other quaternion.
| bool chrono::ChQuaternion< Real >::Equals | ( | const ChQuaternion< Real > & | other, | |
| Real | tol | |||
| ) | const |
Returns true if quaternion equals another quaternion, within a tolerance 'tol'.
| void chrono::ChQuaternion< Real >::Add | ( | const ChQuaternion< Real > | A, | |
| const ChQuaternion< Real > | B | |||
| ) |
The quaternion becomes the sum of the two quaternions A and B: this=A+B
| void chrono::ChQuaternion< Real >::Sub | ( | const ChQuaternion< Real > | A, | |
| const ChQuaternion< Real > | B | |||
| ) |
The quaternion becomes the difference of the two quaternions A and B: this=A-B
| void chrono::ChQuaternion< Real >::Cross | ( | const ChQuaternion< Real > | qa, | |
| const ChQuaternion< Real > | qb | |||
| ) |
The quaternion becomes the quaternion product of the two quaternions A and B: following the classic Hamilton rule: this=AxB This is the true, typical quaternion product. It is NOT commutative.
| double chrono::ChQuaternion< Real >::Dot | ( | const ChQuaternion< Real > | A, | |
| const ChQuaternion< Real > | B | |||
| ) |
The quaternion becomes the dot product of the two quaternion A and B: this=A*B. This kind of product is not used a lot, anyway...
| void chrono::ChQuaternion< Real >::Mul | ( | const ChQuaternion< Real > | A, | |
| const Real | v | |||
| ) |
The quaternion becomes the product of a quaternion A and a scalar v: this=A*v
| void chrono::ChQuaternion< Real >::Scale | ( | const Real | v | ) |
The quaternion is multiplied by a scalar factor 's' this*=v
| double chrono::ChQuaternion< Real >::Length | ( | ) |
Computes the euclidean norm of the quaternion, that is its length or magnitude
| double chrono::ChQuaternion< Real >::Length2 | ( | ) |
Computes the euclidean norm of the quaternion, squared (i.e. as Length(), but skipping the square root)
| double chrono::ChQuaternion< Real >::LengthInf | ( | ) |
Computes the infinite norm of the quaternion, that is the maximum absolute value of one of its elements
| bool chrono::ChQuaternion< Real >::Normalize | ( | ) |
Normalize this quaternion, so that its euclidean length is 1. Returns false if original quaternion had zero length (in such a case it will be defaulted as 1,0,0,0) otherwise returns true for success.
| void chrono::ChQuaternion< Real >::Conjugate | ( | const ChQuaternion< Real > & | A | ) |
The quaternion is set as the conjugate of A quaternion.
| void chrono::ChQuaternion< Real >::Conjugate | ( | ) |
The quaternion itself is conjugated (its vectorial part changes sign).
| ChQuaternion<Real> chrono::ChQuaternion< Real >::GetConjugate | ( | ) | const |
Returns a conjugated version of this quaternion.
| ChVector<Real> chrono::ChQuaternion< Real >::Rotate | ( | const ChVector< Real > | A | ) | const |
Rotates the vector A on the basis of this quaternion: res=p*[0,A]*p' (speed-optimized version). Endomorphism assumes p is already normalized.
| ChVector<Real> chrono::ChQuaternion< Real >::RotateBack | ( | const ChVector< Real > | A | ) | const |
Rotates the vector A on the basis of conjugate of this quaternion: res=p'*[0,A]*p (speed-optimized version). Endomorphism assumes p is already normalized.
| void chrono::ChQuaternion< Real >::Q_from_AngAxis | ( | const double | angle, | |
| const ChVector< Real > | axis | |||
| ) |
Sets the quaternion from an agle of rotation and an axis, defined in _absolute_ coords. The axis is supposed to be fixed, i.e. it is constant during rotation! NOTE, axismust be normalized!
| void chrono::ChQuaternion< Real >::Q_from_AngX | ( | const double | angleX | ) |
Sets the quaternion from an agle of rotation about X axis.
| void chrono::ChQuaternion< Real >::Q_from_AngY | ( | const double | angleY | ) |
Sets the quaternion from an agle of rotation about Y axis.
| void chrono::ChQuaternion< Real >::Q_from_AngZ | ( | const double | angleZ | ) |
Sets the quaternion from an agle of rotation about Z axis.
| void chrono::ChQuaternion< Real >::Q_to_AngAxis | ( | double & | a_angle, | |
| ChVector< Real > & | a_axis | |||
| ) |
Converts the quaternion to an agle of rotation and an axis, defined in _absolute_ coords. Resulting angle and axis must be passed as parameters
| void chrono::ChQuaternion< Real >::Q_from_NasaAngles | ( | const ChVector< Real > | mang | ) |
Sets the quaternion from three angles (NASA angle set) heading, bank and attitude
| ChVector<Real> chrono::ChQuaternion< Real >::Q_to_NasaAngles | ( | ) |
Converts the quaternion to three angles (NASA angle set) heading, bank and attitude
| void chrono::ChQuaternion< Real >::Qdt_from_Wabs | ( | const ChVector< Real > | w, | |
| const ChQuaternion< Real > | q | |||
| ) |
Sets the quaternion dq/dt. Inputs: the vector of angular speed w specified in _absolute_ coords, and the rotation expressed as a quaternion q.
| void chrono::ChQuaternion< Real >::Qdt_from_Wrel | ( | const ChVector< Real > | w, | |
| const ChQuaternion< Real > | q | |||
| ) |
Sets the quaternion dq/dt. Inputs: the vector of angular speed w specified in _relative coords, and the rotation expressed as a quaternion q.
| void chrono::ChQuaternion< Real >::Qdt_to_Wabs | ( | ChVector< Real > | w, | |
| const ChQuaternion< Real > | q | |||
| ) |
Computes the vector of angular speed 'w' specified in _absolute_ coords, from the quaternion dq/dt and the rotation expressed as a quaternion q.
| void chrono::ChQuaternion< Real >::Qdt_to_Wrel | ( | ChVector< Real > | w, | |
| const ChQuaternion< Real > | q | |||
| ) |
Computes the vector of angular speed 'w' specified in _relative_ coords, from the quaternion dq/dt and the rotation expressed as a quaternion q.
| void chrono::ChQuaternion< Real >::Qdtdt_from_Aabs | ( | const ChVector< Real > | a, | |
| const ChQuaternion< Real > | q, | |||
| const ChQuaternion< Real > | q_dt | |||
| ) |
Sets the quaternion ddq/dtdt. Inputs: the vector of angular acceleration 'a' specified in _absolute_ coords, the rotation expressed as a quaternion q, the rotation speed as a quaternion 'q_dt'.
| void chrono::ChQuaternion< Real >::Qdtdt_from_Arel | ( | const ChVector< Real > | a, | |
| const ChQuaternion< Real > | q, | |||
| const ChQuaternion< Real > | q_dt | |||
| ) |
Sets the quaternion ddq/dtdt. Inputs: the vector of angular acceleration 'a' specified in _relative_ coords, the rotation expressed as a quaternion q, the rotation speed as a quaternion 'q_dt'.
| void chrono::ChQuaternion< Real >::Qdt_from_AngAxis | ( | const ChQuaternion< Real > | q, | |
| const double | angle_dt, | |||
| const ChVector< Real > | axis | |||
| ) |
Sets the quaternion dq/dt. Inputs: the axis of rotation 'axis' (assuming it is already normalized and in _absolute_ coords), the angular speed 'angle_dt' (scalar value), and the rotation expressed as a quaternion 'q'.
| void chrono::ChQuaternion< Real >::Qdtdt_from_AngAxis | ( | const ChQuaternion< Real > | q, | |
| const ChQuaternion< Real > | q_dt, | |||
| const double | angle_dtdt, | |||
| const ChVector< Real > | axis | |||
| ) |
Sets the quaternion ddq/dtdt. Inputs: the axis of ang.acceleration 'axis' (assuming it is already normalized and in _absolute_ coords), the angular acceleration 'angle_dtdt' (scalar value), the rotation expressed as a quaternion 'quat' and th rotation speed 'q_dt'.
| void chrono::ChQuaternion< Real >::ImmQ_complete | ( | const ChVector< Real > & | qimm | ) |
Given the immaginary (vectorial) {e1 e2 e3} part of a quaternion, tries to set the entire quaternion q = {e0, e1, e2, e3}. Also for q_dt and q_dtdt Note: singularities may happen!
| ChVector<Real> chrono::ChQuaternion< Real >::GetXaxis | ( | ) |
Gets the X axis of a coordsystem, given the quaternion which represents the alignment of the coordsystem. Assuming that quaternion is already normalized!
| void chrono::ChQuaternion< Real >::StreamOUT | ( | ChStreamOutAscii & | mstream | ) |
Method to allow serializing transient data into ascii as a readable item, for example "chrono::GetLog() << myobject;"
| void chrono::ChQuaternion< Real >::StreamOUT | ( | ChStreamOutBinary & | mstream | ) |
Method to allow serializing transient data into a persistent binary archive (ex: a file).
| void chrono::ChQuaternion< Real >::StreamIN | ( | ChStreamInBinary & | mstream | ) |
Method to allow deserializing a persistent binary archive (ex: a file) into transient data.
CHRONO::ENGINE