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