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:26
QuaternionType GetConjugate() const
Definition: quaternion.h:423
VectorType v
direction vector component
Definition: quaternion.h:238
Py_UNICODE c
Definition: unicodeobject.h:1200
Float64 Float
Definition: apibase.h:211
constexpr 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:170
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:468
Result< QuaternionType > GetExp() const
Definition: quaternion.h:443
Result< QuaternionType > GetInverse() const
Definition: quaternion.h:409
Result< QuaternionType > GetNormalized() const
Definition: quaternion.h:400
static Result< QuaternionType > GetLerp(const QuaternionType &q1, const QuaternionType &q2, const ValueType t)
Definition: quaternion.h:473
Result< QuaternionType > GetPow(const ValueType &t) const
Definition: quaternion.h:457
Result< QuaternionType > GetLog() const
Definition: quaternion.h:428
maxon::Float Float
Definition: ge_sys_math.h:62
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:1524
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:322
void SetRotation(const VectorType &rotation)
Definition: quaternion.h:342
void SetAxisRotation(const VectorType &axis, const ValueType rotation)
Definition: quaternion.h:353
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:359
Conversion
A maxon::Quaternion instance can be converted to maxon::String using:
String ToString(const FormatStatement *formatStatement=nullptr) const
Definition: quaternion.h:571
Definition: string.h:1237
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:243
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:40
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:72
Further Reading