reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofMatrix4x4.cpp File Reference
#include "ofMatrix4x4.h"
#include <limits>
#include <stdlib.h>
#include <iomanip>

Classes

struct  _affineParts
 

Macros

#define SET_ROW(row, v1, v2, v3, v4)
 
#define INNER_PRODUCT(a, b, r, c)
 
#define QX   q._v[0]
 
#define QY   q._v[1]
 
#define QZ   q._v[2]
 
#define QW   q._v[3]
 
#define COMPILE_getRotate_Original
 
#define d   r22
 
#define px   r00
 
#define py   r01
 
#define pz   r02
 
#define one_over_s   one_over_det
 
#define a   r10
 
#define b   r11
 
#define c   r12
 
#define tx   r10
 
#define ty   r11
 
#define tz   r12
 
#define SGL_SWAP(a, b, temp)   ((temp)=(a),(a)=(b),(b)=(temp))
 
#define SQRTHALF   (0.7071067811865475244)
 
#define matrixCopy(C, gets, A, n)
 
#define mat_tpose(AT, gets, A, n)
 
#define mat_pad(A)   (A[W][X]=A[X][W]=A[W][Y]=A[Y][W]=A[W][Z]=A[Z][W]=0,A[W][W]=1)
 
#define matBinop(C, gets, A, op, B, n)
 
#define mat_copy(C, gets, A, n)
 
#define caseMacro(i, j, k, I, J, K)
 
#define TOL   1.0e-6
 
#define sgn(n, v)   ((n)?-(v):(v))
 
#define swap(a, i, j)   {a[3]=a[i]; a[i]=a[j]; a[j]=a[3];}
 
#define cycle(a, p)
 

Typedefs

typedef ofQuaternion HVect
 
typedef double _HMatrix[4][4]
 

Enumerations

enum  QuatPart { X , Y , Z , W }
 

Functions

bool equivalent (double lhs, double rhs, double epsilon=1e-6)
 
template<typename T >
square (T v)
 
bool invert_4x3 (const ofMatrix4x4 &src, ofMatrix4x4 &dst)
 
bool invert_4x4 (const ofMatrix4x4 &rhs, ofMatrix4x4 &dst)
 
template<class T >
SGL_ABS (T a)
 
void mat_mult (_HMatrix A, _HMatrix B, _HMatrix AB)
 
double mat_norm (_HMatrix M, int tpose)
 
double norm_inf (_HMatrix M)
 
double norm_one (_HMatrix M)
 
int find_max_col (_HMatrix M)
 
void vcross (double *va, double *vb, double *v)
 
double vdot (double *va, double *vb)
 
void adjoint_transpose (_HMatrix M, _HMatrix MadjT)
 
void make_reflector (double *v, double *u)
 
void reflect_cols (_HMatrix M, double *u)
 
void reflect_rows (_HMatrix M, double *u)
 
void do_rank1 (_HMatrix M, _HMatrix Q)
 
void do_rank2 (_HMatrix M, _HMatrix MadjT, _HMatrix Q)
 
ofQuaternion Qt_Scale (ofQuaternion q, double w)
 
ofQuaternion quatFromMatrix (_HMatrix mat)
 
double polarDecomp (_HMatrix M, _HMatrix Q, _HMatrix S)
 
HVect spectDecomp (_HMatrix S, _HMatrix U)
 
ofQuaternion Qt_Conj (ofQuaternion q)
 
ofQuaternion Qt_Mul (ofQuaternion qL, ofQuaternion qR)
 
ofQuaternion Qt_ (double x, double y, double z, double w)
 
ofQuaternion snuggle (ofQuaternion q, HVect *k)
 
void decompAffine (_HMatrix A, _affineParts *parts)
 
std::ostream & operator<< (std::ostream &os, const ofMatrix4x4 &M)
 
std::istream & operator>> (std::istream &is, ofMatrix4x4 &M)
 

Macro Definition Documentation

◆ a

#define a   r10

◆ b

#define b   r11

◆ c

#define c   r12

◆ caseMacro

#define caseMacro (   i,
  j,
  k,
  I,
  J,
 
)
Value:
case I:\
s = sqrt( (mat[I][I] - (mat[J][J]+mat[K][K])) + mat[W][W] );\
qu.i() = s*0.5;\
s = 0.5 / s;\
qu.j() = (mat[I][J] + mat[J][I]) * s;\
qu.k() = (mat[K][I] + mat[I][K]) * s;\
qu.w() = (mat[K][J] - mat[J][K]) * s;\
break
@ W
Definition ofMatrix4x4.cpp:967

◆ COMPILE_getRotate_Original

#define COMPILE_getRotate_Original

◆ cycle

#define cycle (   a,
 
)
Value:
if (p) {a[3]=a[0]; a[0]=a[1]; a[1]=a[2]; a[2]=a[3];}\
else {a[3]=a[2]; a[2]=a[1]; a[1]=a[0]; a[0]=a[3];}
#define a

◆ d

#define d   r22

◆ INNER_PRODUCT

#define INNER_PRODUCT (   a,
  b,
  r,
  c 
)
Value:
((a)._mat[r][0] * (b)._mat[0][c]) \
+((a)._mat[r][1] * (b)._mat[1][c]) \
+((a)._mat[r][2] * (b)._mat[2][c]) \
+((a)._mat[r][3] * (b)._mat[3][c])
#define c
#define b

◆ mat_copy

#define mat_copy (   C,
  gets,
  A,
 
)
Value:
{int i,j; for(i=0;i<n;i++) for(j=0;j<n;j++)\
C[i][j] gets (A[i][j]);}

Copy nxn matrix A to C using "gets" for assignment

◆ mat_pad

#define mat_pad (   A)    (A[W][X]=A[X][W]=A[W][Y]=A[Y][W]=A[W][Z]=A[Z][W]=0,A[W][W]=1)

Fill out 3x3 matrix to 4x4

◆ mat_tpose

#define mat_tpose (   AT,
  gets,
  A,
 
)
Value:
{int i,j; for(i=0;i<n;i++) for(j=0;j<n;j++)\
AT[i][j] gets (A[j][i]);}

Copy transpose of nxn matrix A to C using "gets" for assignment

◆ matBinop

#define matBinop (   C,
  gets,
  A,
  op,
  B,
 
)
Value:
{int i,j; for(i=0;i<n;i++) for(j=0;j<n;j++)\
C[i][j] gets (A[i][j]) op (B[i][j]);}

Assign nxn matrix C the element-wise combination of A and B using "op"

◆ matrixCopy

#define matrixCopy (   C,
  gets,
  A,
 
)
Value:
{int i, j; for (i=0;i<n;i++) for (j=0;j<n;j++)\
C[i][j] gets (A[i][j]);}

Copy nxn matrix A to C using "gets" for assignment

◆ one_over_s

#define one_over_s   one_over_det

◆ px

#define px   r00

◆ py

#define py   r01

◆ pz

#define pz   r02

◆ QW

#define QW   q._v[3]

◆ QX

#define QX   q._v[0]

◆ QY

#define QY   q._v[1]

◆ QZ

#define QZ   q._v[2]

◆ SET_ROW

#define SET_ROW (   row,
  v1,
  v2,
  v3,
  v4 
)
Value:
_mat[(row)][0] = (v1); \
_mat[(row)][1] = (v2); \
_mat[(row)][2] = (v3); \
_mat[(row)][3] = (v4);

◆ SGL_SWAP

#define SGL_SWAP (   a,
  b,
  temp 
)    ((temp)=(a),(a)=(b),(b)=(temp))

◆ sgn

#define sgn (   n,
 
)    ((n)?-(v):(v))

◆ SQRTHALF

#define SQRTHALF   (0.7071067811865475244)

◆ swap

#define swap (   a,
  i,
 
)    {a[3]=a[i]; a[i]=a[j]; a[j]=a[3];}

◆ TOL

#define TOL   1.0e-6

◆ tx

#define tx   r10

◆ ty

#define ty   r11

◆ tz

#define tz   r12

Typedef Documentation

◆ _HMatrix

typedef double _HMatrix[4][4]

◆ HVect

Enumeration Type Documentation

◆ QuatPart

enum QuatPart
Enumerator

Function Documentation

◆ adjoint_transpose()

void adjoint_transpose ( _HMatrix  M,
_HMatrix  MadjT 
)

Set MadjT to transpose of inverse of M times determinant of M

◆ decompAffine()

void decompAffine ( _HMatrix  A,
_affineParts parts 
)

◆ do_rank1()

void do_rank1 ( _HMatrix  M,
_HMatrix  Q 
)

Find orthogonal factor Q of rank 1 (or less) M

◆ do_rank2()

void do_rank2 ( _HMatrix  M,
_HMatrix  MadjT,
_HMatrix  Q 
)

Find orthogonal factor Q of rank 2 (or less) M using adjoint transpose

◆ equivalent()

bool equivalent ( double  lhs,
double  rhs,
double  epsilon = 1e-6 
)
inline

◆ find_max_col()

int find_max_col ( _HMatrix  M)

Return index of column of M containing maximum abs entry, or -1 if M=0

◆ invert_4x3()

bool invert_4x3 ( const ofMatrix4x4 src,
ofMatrix4x4 dst 
)

4x3 matrix invert, not right hand column is assumed to be 0,0,0,1.

◆ invert_4x4()

bool invert_4x4 ( const ofMatrix4x4 rhs,
ofMatrix4x4 dst 
)

full 4x4 matrix invert.

◆ make_reflector()

void make_reflector ( double *  v,
double *  u 
)

Setup u for Household reflection to zero all v components but first

◆ mat_mult()

void mat_mult ( _HMatrix  A,
_HMatrix  B,
_HMatrix  AB 
)

Multiply the upper left 3x3 parts of A and B to get AB

◆ mat_norm()

double mat_norm ( _HMatrix  M,
int  tpose 
)

◆ norm_inf()

double norm_inf ( _HMatrix  M)

◆ norm_one()

double norm_one ( _HMatrix  M)

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const ofMatrix4x4 M 
)

◆ operator>>()

std::istream & operator>> ( std::istream &  is,
ofMatrix4x4 M 
)

◆ polarDecomp()

double polarDecomp ( _HMatrix  M,
_HMatrix  Q,
_HMatrix  S 
)

◆ Qt_()

ofQuaternion Qt_ ( double  x,
double  y,
double  z,
double  w 
)

◆ Qt_Conj()

ofQuaternion Qt_Conj ( ofQuaternion  q)

◆ Qt_Mul()

ofQuaternion Qt_Mul ( ofQuaternion  qL,
ofQuaternion  qR 
)

◆ Qt_Scale()

ofQuaternion Qt_Scale ( ofQuaternion  q,
double  w 
)

◆ quatFromMatrix()

ofQuaternion quatFromMatrix ( _HMatrix  mat)

◆ reflect_cols()

void reflect_cols ( _HMatrix  M,
double *  u 
)

Apply Householder reflection represented by u to column vectors of M

◆ reflect_rows()

void reflect_rows ( _HMatrix  M,
double *  u 
)

Apply Householder reflection represented by u to row vectors of M

◆ SGL_ABS()

template<class T >
T SGL_ABS ( a)
inline

◆ snuggle()

ofQuaternion snuggle ( ofQuaternion  q,
HVect k 
)

◆ spectDecomp()

HVect spectDecomp ( _HMatrix  S,
_HMatrix  U 
)

◆ square()

template<typename T >
T square ( v)
inline

◆ vcross()

void vcross ( double *  va,
double *  vb,
double *  v 
)

◆ vdot()

double vdot ( double *  va,
double *  vb 
)

Return dot product of length 3 vectors va and vb