NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Functions
Mathematical Functions

Functions

static void plRelativeTransform (const double a[8], const double b[8], double c[8])
 
static void plTransformToMatrixf (const double trans[8], float matrix[16])
 
static void plTransformToMatrixd (const double trans[8], double matrix[16])
 
static void plAnglesFromMatrixf (float angles[3], const float matrix[16])
 
static void plAnglesFromMatrixd (double angles[3], const double matrix[16])
 
static void plCoordsFromMatrixf (float coords[3], const float matrix[16])
 
static void plCoordsFromMatrixd (double coords[3], const double matrix[16])
 

Detailed Description

These are some useful math functions. Note that the matrices are stored using the OpenGL convention:

\[ \left( \begin{array}{cccc} m[0] & m[4] & m[8] & m[12] \\ m[1] & m[5] & m[9] & m[13] \\ m[2] & m[6] & m[10] & m[14] \\ m[3] & m[7] & m[11] & m[15] \\ \end{array} \right) \]

Function Documentation

static void plAnglesFromMatrixd ( double  angles[3],
const double  matrix[16] 
)
static

Extract rotation angles from a 4x4 double matrix. The order of the rotations is:

  1. roll around x axis
  2. pitch around y axis
  3. yaw around z axis
static void plAnglesFromMatrixf ( float  angles[3],
const float  matrix[16] 
)
static

Extract rotation angles from a 4x4 float matrix. The order of the rotations is:

  1. roll around x axis
  2. pitch around y axis
  3. yaw around z axis
static void plCoordsFromMatrixd ( double  coords[3],
const double  matrix[16] 
)
static

Extract position coordinates from a 4x4 double matrix. These have the same value as the position coordinates in the quaternion transformation.

static void plCoordsFromMatrixf ( float  coords[3],
const float  matrix[16] 
)
static

Extract position coordinates from a 4x4 float matrix. These have the same value as the position coordinates in the quaternion transformation.

static void plRelativeTransform ( const double  a[8],
const double  b[8],
double  c[8] 
)
static

Find the position and orientation of a tool relative to a reference tool. This is done by quaternion division.

Parameters
athe original tool transformation
bthe reference tool transformation
cthe resulting relative transformation

The pointer c can be the same as pointer a if you want to do the division in-place.

static void plTransformToMatrixd ( const double  trans[8],
double  matrix[16] 
)
static

Convert a quaternion transformation into a 4x4 double matrix.

static void plTransformToMatrixf ( const double  trans[8],
float  matrix[16] 
)
static

Convert a quaternion transformation into a 4x4 float matrix.