1#ifndef SimTK_SimTKCOMMON_QUATERNION_H
2#define SimTK_SimTKCOMMON_QUATERNION_H
40template <
class P>
class Rotation_;
41template <
class P>
class Quaternion_;
133 const RealP
epsilon = std::numeric_limits<RealP>::epsilon();
#define SimTK_SimTKCOMMON_EXPORT
Definition SimTKcommon/include/SimTKcommon/internal/common.h:224
This file is the user-includeable header to be included in user programs to provide fixed-length Vec ...
Declares and defines the UnitVec and UnitRow classes.
A Quaternion is a Vec4 with the following behavior:
Definition Quaternion.h:65
void setQuaternionFromAngleAxis(const Vec4P &av)
Set this quaternion from an angle-axis rotation packed into a 4-vector as [a vx vy vz].
void setQuaternionToZeroRotation()
The ZeroRotation quaternion is [1 0 0 0].
Definition Quaternion.h:98
Vec4P convertQuaternionToAngleAxis() const
Returns [ a vx vy vz ] with (a,v) in canonical form, i.e., -180 < a <= 180 and |v|=1.
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 Quaternion_ &q)
Zero-cost copy constructor just copies the source without conversion to canonical form or normalizati...
Definition Quaternion.h:76
Quaternion_(const Vec4P &v, bool)
Use this constructor only if you are sure v is normalized to 1.0.
Definition Quaternion.h:154
Quaternion_ & normalizeThis()
Normalize an already constructed quaternion in place; but do you really need to do this?...
Definition Quaternion.h:132
Quaternion_ & operator=(const Quaternion_ &q)
Zero-cost copy assignment just copies the source without conversion to canonical form or normalizatio...
Definition Quaternion.h:80
void setQuaternionFromAngleAxis(const RealP &a, const UnitVec< P, 1 > &v)
Set this quaternion from an angle-axis rotation provided as an angle a and a separate unit vector [vx...
Quaternion_()
Default constructor produces the ZeroRotation quaternion [1 0 0 0] (not NaN - even in debug mode).
Definition Quaternion.h:72
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
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_(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
void setQuaternionToNaN()
Set quaternion to all-NaN.
Definition Quaternion.h:102
Quaternion_(const Rotation_< P > &)
Constructs a canonical quaternion from a rotation matrix (cost is about 60 flops).
The Rotation class is a Mat33 that guarantees that the matrix can be interpreted as a legitimate 3x3 ...
Definition Rotation.h:111
This class is a Vec3 plus an ironclad guarantee either that:
Definition UnitVec.h:56
This is a fixed-length column vector designed for no-overhead inline computation.
Definition Vec.h:184
void setToNaN()
Set every scalar in this Vec to NaN; this is the default initial value in Debug builds,...
Definition Vec.h:812
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
CNT< ScalarNormSq >::TSqrt norm() const
Definition Vec.h:610
void set(int i, const E &value)
Variant of operator[] that's scripting friendly to set ith entry.
Definition Vec.h:995
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition Assembler.h:37
Quaternion_< Real > Quaternion
Definition Quaternion.h:43
Quaternion_< double > dQuaternion
Definition Quaternion.h:45
Quaternion_< float > fQuaternion
Definition Quaternion.h:44