Pyrogenesis  trunk
Macros | Functions | Variables
Decompose.cpp File Reference
#include "precompiled.h"
#include <math.h>
#include "Decompose.h"
Include dependency graph for Decompose.cpp:

Macros

#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. More...
 
#define mat_copy(C, gets, A, n)
 Copy nxn matrix A to C using "gets" for assignment. More...
 
#define mat_tpose(AT, gets, A, n)
 Copy transpose of nxn matrix A to C using "gets" for assignment. More...
 
#define mat_binop(C, gets, A, op, B, n)
 Assign nxn matrix C the element-wise combination of A and B using "op". More...
 
#define caseMacro(i, j, k, I, J, K)
 
#define TOL   1.0e-6
 
#define SQRTHALF   (0.7071067811865475244)
 
#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)
 

Functions

void mat_mult (HMatrix A, HMatrix B, HMatrix AB)
 Multiply the upper left 3x3 parts of A and B to get AB. More...
 
float vdot (float *va, float *vb)
 Return dot product of length 3 vectors va and vb. More...
 
void vcross (float *va, float *vb, float *v)
 Set v to cross product of length 3 vectors va and vb. More...
 
void adjoint_transpose (HMatrix M, HMatrix MadjT)
 Set MadjT to transpose of inverse of M times determinant of M. More...
 
Quat Qt_ (float x, float y, float z, float w)
 
Quat Qt_Conj (Quat q)
 
Quat Qt_Mul (Quat qL, Quat qR)
 
Quat Qt_Scale (Quat q, float w)
 
Quat Qt_FromMatrix (HMatrix mat)
 
float mat_norm (HMatrix M, int tpose)
 Compute either the 1 or infinity norm of M, depending on tpose. More...
 
float norm_inf (HMatrix M)
 
float norm_one (HMatrix M)
 
int find_max_col (HMatrix M)
 Return index of column of M containing maximum abs entry, or -1 if M=0. More...
 
void make_reflector (float *v, float *u)
 Setup u for Household reflection to zero all v components but first. More...
 
void reflect_cols (HMatrix M, float *u)
 Apply Householder reflection represented by u to column vectors of M. More...
 
void reflect_rows (HMatrix M, float *u)
 Apply Householder reflection represented by u to row vectors of M. More...
 
void do_rank1 (HMatrix M, HMatrix Q)
 Find orthogonal factor Q of rank 1 (or less) M. More...
 
void do_rank2 (HMatrix M, HMatrix MadjT, HMatrix Q)
 Find orthogonal factor Q of rank 2 (or less) M using adjoint transpose. More...
 
float polar_decomp (HMatrix M, HMatrix Q, HMatrix S)
 
HVect spect_decomp (HMatrix S, HMatrix U)
 
Quat snuggle (Quat q, HVect *k)
 
void decomp_affine (HMatrix A, AffineParts *parts)
 
void invert_affine (AffineParts *parts, AffineParts *inverse)
 

Variables

static HMatrix mat_id = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}}
 

Macro Definition Documentation

#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
Definition: Decompose.h:22
Definition: cache.cpp:316
#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 mat_binop (   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".

#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.

#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.

#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]);}
#define AT(x)

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

#define sgn (   n,
 
)    ((n)?-(v):(v))
#define SQRTHALF   (0.7071067811865475244)
#define swap (   a,
  i,
 
)    {a[3]=a[i]; a[i]=a[j]; a[j]=a[3];}
#define TOL   1.0e-6

Function Documentation

void adjoint_transpose ( HMatrix  M,
HMatrix  MadjT 
)

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

void decomp_affine ( HMatrix  A,
AffineParts parts 
)
void do_rank1 ( HMatrix  M,
HMatrix  Q 
)

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

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

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

int find_max_col ( HMatrix  M)

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

void invert_affine ( AffineParts parts,
AffineParts inverse 
)
void make_reflector ( float *  v,
float *  u 
)

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

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

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

float mat_norm ( HMatrix  M,
int  tpose 
)

Compute either the 1 or infinity norm of M, depending on tpose.

float norm_inf ( HMatrix  M)
float norm_one ( HMatrix  M)
float polar_decomp ( HMatrix  M,
HMatrix  Q,
HMatrix  S 
)
Quat Qt_ ( float  x,
float  y,
float  z,
float  w 
)
Quat Qt_Conj ( Quat  q)
Quat Qt_FromMatrix ( HMatrix  mat)
Quat Qt_Mul ( Quat  qL,
Quat  qR 
)
Quat Qt_Scale ( Quat  q,
float  w 
)
void reflect_cols ( HMatrix  M,
float *  u 
)

Apply Householder reflection represented by u to column vectors of M.

void reflect_rows ( HMatrix  M,
float *  u 
)

Apply Householder reflection represented by u to row vectors of M.

Quat snuggle ( Quat  q,
HVect k 
)
HVect spect_decomp ( HMatrix  S,
HMatrix  U 
)
void vcross ( float *  va,
float *  vb,
float *  v 
)

Set v to cross product of length 3 vectors va and vb.

float vdot ( float *  va,
float *  vb 
)

Return dot product of length 3 vectors va and vb.

Variable Documentation

HMatrix mat_id = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}}
static