CFx SDK Documentation 2024 SP0
|
#include <GeQuaternion.h>
Public Attributes | |
double | w |
double | x |
double | y |
double | z |
Static Public Attributes | |
static GE_STATIC_EXPORT const OdGeQuaternion | kIdentity |
This class represents a rotation quaternion in 3D space. Quaternions provide a convenient mathematical notation for representing orientations and rotations of objects in three dimensions. Quaternions resolve the problem of "gimbal locks".
The quaternion consists of 2 components:
To define quaternion components, use following formulas:
WW = cos(angle/2) XX = x*sin(angle/2) YY = y*sin(angle/2) ZZ = z*sin(angle/2)
where angle is an angle of desired counter clockwise rotation specified in radians, x, y, z - components of a 3D unit vector that represents axis of rotation. For example, a quaternion that rotates 1.5 radian CCW by the x axis (unit vector(1,0,0)), looks the following way:
WW XX YY ZZ cos(1.5/2) 1*sin(1.5/2) 0*sin(1.5/2) 0*sin(1.5/2)
Quaternions can be converted to rotation matrix (OdGeMatrix3d) or vice versa. Note, that there can be an ambiguity in rotation matrix representation. We use Hamilton multiplication convention for OdGeQuaternion.
Corresponding C++ library: TD_Ge
<group OdGe_Classes>
Definition at line 69 of file GeQuaternion.h.
|
inline |
Default constructor for the OdGeQuaternion class.
Definition at line 79 of file GeQuaternion.h.
|
inline |
Constructor for the OdGeQuaternion class.
ww | [in] The W-component of this quaternion object. |
xx | [in] The X-component of this quaternion object. |
yy | [in] The Y-component of this quaternion object. |
zz | [in] The Z-component of this quaternion object. |
Definition at line 94 of file GeQuaternion.h.
|
inline |
Returns the dot product of this quaternion and the specified quaternion.
quat | [in] Any quaternion to be multiplied with this quaternion. |
Definition at line 418 of file GeQuaternion.h.
|
inline |
Calculates 3D rotation matrix that represents this quaternion.
Definition at line 135 of file GeQuaternion.h.
|
inline |
Returns true if and only if quat is identical to this quaternion, within the specified tolerance.
quat | [in] Quaternion to be compared to this quaternion. |
tol | [in] Geometric tolerance. |
Definition at line 223 of file GeQuaternion.h.
double OdGeQuaternion::norm | ( | ) | const |
Returns the norm of this quaternion.
OdGeQuaternion & OdGeQuaternion::normalize | ( | const OdGeTol & | tol = OdGeContext::gTol | ) |
Sets this quaternion to the unit quaternion and returns a reference to this quaternion
tol | [in] Geometric tolerance. |
|
inline |
Returns the square of the norm of this quaternion.
Definition at line 396 of file GeQuaternion.h.
|
inline |
Inequality operator. Returns true if this quaternion is not equal to the input quaternion.
quat | [in] Input quaternion that is checked for inequality. |
Definition at line 248 of file GeQuaternion.h.
|
inline |
Multiplication operator for the OdGeQuaternion class.
scale | [in] Input scale factor. |
Definition at line 261 of file GeQuaternion.h.
|
inline |
Multiplication operator for the OdGeQuaternion class.
scale | [in] Input scale factor. |
Definition at line 277 of file GeQuaternion.h.
|
inline |
Addition operator for the OdGeQuaternion class.
quat | [in] Input quaternion, component values of which are added to component values of this quaternion. |
Definition at line 327 of file GeQuaternion.h.
|
inline |
Addition operator for the OdGeQuaternion class.
quat | [in] A reference to a quaternion, component values of which are added to component values of this quaternion. |
Definition at line 341 of file GeQuaternion.h.
|
inline |
Inverse operator.
Definition at line 391 of file GeQuaternion.h.
|
inline |
Subtraction operator for the OdGeQuaternion class.
quat | [in] Input quaternion, component values of which are subtracted from component values of this quaternion. |
Definition at line 359 of file GeQuaternion.h.
|
inline |
Subtraction operator for the OdGeQuaternion class.
quat | [in] A reference to a quaternion, component values of which are subtracted from component values of this quaternion. |
Definition at line 373 of file GeQuaternion.h.
|
inline |
Division operator for the OdGeQuaternion class.
scale | [in] Input scale factor. |
Definition at line 295 of file GeQuaternion.h.
|
inline |
Division operator for the OdGeQuaternion class.
scale | [in] Input scale factor. |
Definition at line 309 of file GeQuaternion.h.
|
inline |
Equality operator. Returns true if this quaternion is equal to the input quaternion.
quat | [in] Input quaternion that is checked for equality. |
Definition at line 238 of file GeQuaternion.h.
|
inline |
Rotates specified 3D point using this quaternion.
sourcePoint | [out] A 3D point that is rotated. |
Definition at line 161 of file GeQuaternion.h.
|
inline |
Rotates specified 3D vector using this quaternion.
vector | [out] A 3D vector that is rotated. |
Definition at line 175 of file GeQuaternion.h.
|
inline |
Rotates specified 3D point using this quaternion but in the opposite direction.
sourcePoint | [out] A 3D point that is rotated. |
Definition at line 193 of file GeQuaternion.h.
|
inline |
Rotates specified 3D vector using this quaternion but in the opposite direction.
vector | [out] A 3D vector that is rotated. |
Definition at line 207 of file GeQuaternion.h.
OdGeQuaternion & OdGeQuaternion::set | ( | const OdGeMatrix3d & | matrix | ) |
Converts passed rotation matrix into the quaternion.
matrix | [in] A 3D matrix that defines components of this quaternion. |
|
inline |
Set components for the quaternion and returns a reference to it.
ww | [in] The W-component of this quaternion object. |
xx | [in] The X-component of this quaternion object. |
yy | [in] The Y-component of this quaternion object. |
zz | [in] The Z-component of this quaternion object. |
Definition at line 106 of file GeQuaternion.h.
OdGeQuaternion OdGeQuaternion::slerp | ( | OdGeQuaternion & | q, |
double | t, | ||
bool | bUseShortestPath | ||
) |
Performs spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation. It refers to constant-speed motion along a unit-radius great circle arc, given the ends and an interpolation parameter between 0 and 1
q | [in] second quaternion to be interpolated between (first is this quaternion) |
t | [in] a scalar between 0.0 (at p) and 1.0 (at q) |
bUseShortestPath | [in] boolean that indicates whether to compute quaternions that constitute the shortest possible arc on a four-dimensional unit sphere. |
|
static |
Identity quaternion (1, 0, 0, 0), i.e. a quaternion that doesn't cause any rotation.
Definition at line 453 of file GeQuaternion.h.
double OdGeQuaternion::w |
Scalar part.
Definition at line 436 of file GeQuaternion.h.
double OdGeQuaternion::x |
First vector part.
Definition at line 440 of file GeQuaternion.h.
double OdGeQuaternion::y |
Second vector part.
Definition at line 444 of file GeQuaternion.h.
double OdGeQuaternion::z |
Third vector part.
Definition at line 448 of file GeQuaternion.h.