Go to the documentation of this file. 1 #ifndef SimTK_SimTKCOMMON_QUATERNION_H
2 #define SimTK_SimTKCOMMON_QUATERNION_H
133 const RealP epsilon = std::numeric_limits<RealP>::epsilon();
137 else (*
this) *= (1/magnitude);
173 #endif // SimTK_SimTKCOMMON_QUATERNION_H_
void setToNaN()
Set every scalar in this Vec to NaN; this is the default initial value in Debug builds,...
Definition: Vec.h:812
void setQuaternionToNaN()
Set quaternion to all-NaN.
Definition: Quaternion.h:102
void setQuaternionFromAngleAxis(const Vec4P &av)
Set this quaternion from an angle-axis rotation packed into a 4-vector as [a vx vy vz].
This is a System that represents the dynamics of a particle moving along a smooth surface.
Definition: Assembler.h:37
Quaternion_ & normalizeThis()
Normalize an already constructed quaternion in place; but do you really need to do this?...
Definition: Quaternion.h:132
Quaternion_< double > dQuaternion
Definition: Quaternion.h:45
Quaternion_ & operator=(const Quaternion_ &q)
Zero-cost copy assignment just copies the source without conversion to canonical form or normalizatio...
Definition: Quaternion.h:80
This class is a Vec3 plus an ironclad guarantee either that:
Definition: UnitVec.h:40
The Rotation class is a Mat33 that guarantees that the matrix can be interpreted as a legitimate 3x3 ...
Definition: Quaternion.h:40
This is a fixed-length column vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:618
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:224
Quaternion_(const Vec4P &q)
Construct a quaternion from a 4-vector and normalize the result, which costs about 40 flops.
Definition: Quaternion.h:89
Quaternion_ normalize() const
Return a normalized copy of this quaternion; but do you really need to do this? Quaternions should be...
Definition: Quaternion.h:147
Quaternion_(const Vec4P &v, bool)
Use this constructor only if you are sure v is normalized to 1.0.
Definition: Quaternion.h:154
Quaternion_()
Default constructor produces the ZeroRotation quaternion [1 0 0 0] (not NaN - even in debug mode).
Definition: Quaternion.h:72
Quaternion_(RealP e0, RealP e1, RealP e2, RealP e3)
Construct a quaternion from four scalars and normalize the result, which costs about 40 flops.
Definition: Quaternion.h:85
Quaternion_< float > fQuaternion
Definition: Quaternion.h:44
Quaternion_(const Quaternion_ &q)
Zero-cost copy constructor just copies the source without conversion to canonical form or normalizati...
Definition: Quaternion.h:76
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Vec.h:610
Vec4P convertQuaternionToAngleAxis() const
Returns [ a vx vy vz ] with (a,v) in canonical form, i.e., -180 < a <= 180 and |v|=1.
void setQuaternionToZeroRotation()
The ZeroRotation quaternion is [1 0 0 0].
Definition: Quaternion.h:98
Quaternion_< Real > Quaternion
Definition: Quaternion.h:41
Vec & operator=(const Vec &src)
Copy assignment operator copies the logically-included elements from the source Vec; gaps due to stri...
Definition: Vec.h:445
const Vec4P & asVec4() const
Zero-cost cast of a Quaternion_ to its underlying Vec4; this is not converted to axis-angle form.
Definition: Quaternion.h:120
A Quaternion is a Vec4 with the following behavior:
Definition: Quaternion.h:41