API Reference > OdGe Classes > OdGeQuaternion Class
OdGeQuaternion Class
OdGeQuaternion
Syntax
C++
class OdGeQuaternion;

GeQuaternion.h

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:

  1. Component of rotation (WW)
  2. Components of rotation axis (XX, YY, ZZ)
 

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 

 

 
Name 
Description 
 
This is the overview for the OdGeQuaternion constructor overload. 
 
Name 
Description 
 
Identity quaternion (1, 0, 0, 0), i.e. a quaternion that doesn't cause any rotation. 
 
w 
Scalar part. 
 
x 
First vector part. 
 
y 
Second vector part. 
 
z 
Third vector part. 
 
Name 
Description 
 
Returns the dot product of this quaternion and the specified quaternion.
 
 
Calculates 3D rotation matrix that represents this quaternion. 
 
Returns true if and only if quat is identical to this quaternion, within the specified tolerance.
 
 
norm 
Returns the norm of this quaternion. 
 
Sets this quaternion to the unit quaternion and returns a reference to this quaternion
 
 
Returns the square of the norm of this quaternion. 
 
This is the overview for the rotate method overload. 
 
This is the overview for the rotateOpposite method overload. 
 
set 
This is the overview for the set method overload. 
 
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
 
 
Name 
Description 
 
- 
This is the overview for the - operator overload. 
 
!= 
Inequality operator. Returns true if this quaternion is not equal to the input quaternion.
 
 
* 
Multiplication operator for the OdGeQuaternion class.
 
 
*= 
Multiplication operator for the OdGeQuaternion class.  
 
/ 
Division operator for the OdGeQuaternion class.
 
 
/= 
Division operator for the OdGeQuaternion class.
 
 
+ 
Addition operator for the OdGeQuaternion class.
 
 
+= 
Addition operator for the OdGeQuaternion class.
 
 
-= 
Subtraction operator for the OdGeQuaternion class.
 
 
== 
Equality operator. Returns true if this quaternion is equal to the input quaternion.
 
Copyright © 2002–2022. Open Design Alliance. All rights reserved.