Close

Relief for ODA Team in Ukraine

Learn more
ODA Kernel SDK
OdGeQuaternion Class
Syntax
C++
class OdGeQuaternion;

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 

 

OdGeQuaternion

File: GeQuaternion.h 

Module: API Reference 

Copyright © 2002-2022. Open Design Alliance All rights reserved.