About
maxon::Quaternion is a MAXON API class used to represent quaternions and deliver standard mathematical operations. Unit quaternions, also known as versors, provide a convenient mathematical notation for representing orientations and rotations of objects in three dimensions. Compared to Euler angles they are simpler to compose and avoid the problem of gimbal lock. Compared to rotation matrices they are more compact, more numerically stable, and may be more efficient.
Definition: quaternion.h:25
QuaternionType GetConjugate() const
Definition: quaternion.h:422
VectorType v
direction vector component
Definition: quaternion.h:237
Py_UNICODE c
Definition: unicodeobject.h:1200
Float64 Float
Definition: apibase.h:197
MAXON_ATTRIBUTE_FORCE_INLINE Float32 DegToRad(Float32 r)
Converts float value from degrees to radians.
Definition: apibasemath.h:474
#define DiagnosticOutput(formatString,...)
Definition: debugdiagnostics.h:176
Creation and initialization
A maxon::Quaternion instance can be created on the stack and initialized through the proper method using a numerical data type as template:
Standard operations
The maxon::Quaternion class delivers a set of standard mathematical operators to perform calculation with quaternion. The operators deliver are:
quaternionB += quaternionA;
quaternionB -= quaternionA;
Get and Set operations
The maxon::Quaternion class is provided with a number of get methods to retrieve useful data from a maxon::Quaternion instance:
const maxon::Float valSqLength = quatY90.GetSquaredLength();
Definition: c4d_quaternion.h:22
static ValueType GetDot(const QuaternionType &q1, const QuaternionType &q2)
Calculates the dot product of two quaternions.
Definition: quaternion.h:467
Result< QuaternionType > GetExp() const
Definition: quaternion.h:442
Result< QuaternionType > GetInverse() const
Definition: quaternion.h:408
Result< QuaternionType > GetNormalized() const
Definition: quaternion.h:399
static Result< QuaternionType > GetLerp(const QuaternionType &q1, const QuaternionType &q2, const ValueType t)
Definition: quaternion.h:472
Result< QuaternionType > GetPow(const ValueType &t) const
Definition: quaternion.h:456
Result< QuaternionType > GetLog() const
Definition: quaternion.h:427
maxon::Float Float
Definition: ge_sys_math.h:66
static constexpr Float64 PI05
floating point constant: 0.5 * PI
Definition: apibasemath.h:124
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14
#define iferr_return
Definition: resultbase.h:1519
The maxon::Quaternion class is provided with a number of "set" methods to define a maxon::Quaternion instance:
void SetMatrix(const MatrixType &m)
Definition: quaternion.h:321
void SetRotation(const VectorType &rotation)
Definition: quaternion.h:341
void SetAxisRotation(const VectorType &axis, const ValueType rotation)
Definition: quaternion.h:352
General 3×3 matrix template consisting of three column vectors v1, v2, v3.
Definition: matrix.h:15
The maxon::Quaternion class can be used to easily perform a rotation on a geometrical entity.
MatrixType GetMatrix() const
Derives a rotation matrix from the quaternion.
Definition: quaternion.h:358
Conversion
A maxon::Quaternion instance can be converted to maxon::String using:
String ToString(const FormatStatement *formatStatement=nullptr) const
Definition: quaternion.h:570
Definition: string.h:1235
Utilities
A maxon::Quaternion instance can be read from and written to disk by serializing the data contained using the conventional functions.
const maxon::Id fileID(
"net.maxonexample.quaternion");
Definition: apibaseid.h:253
std::enable_if< GetCollectionKind< T >::value==COLLECTION_KIND::ARRAY, Result< void > >::type ReadDocument(const Url &url, const Id &id, T &object, const DataDictionary &dict=DataDictionary())
Definition: io.h:35
Result< void > WriteDocument(const Url &url, OPENSTREAMFLAGS flags, const Id &id, const T &object, IOFORMAT format=IOFORMAT::DEFAULT, const DataDictionary &dict=DataDictionary())
Definition: io.h:67
Further Reading