next up previous contents index
Next: Functions for Arrays and Up: Utility Functions Previous: Functions on VEC4

Matrix Functions

 

Matrices are declared as double arrays: typedef double MATRIX44[4][4];

The following matrix-operations are possible:

void g_matrix44_assign (MATRIX44 s, MATRIX44 d)
d = s

double g_matrix44_det (MATRIX44 m)
returns the determinant of the main 3x3 part of m

int g_matrix44_inv (MATRIX44 m, MATRIX44 d)
inverts the main 3x3 part of m and stores result in d

int g_matrix44_invert_gauss (MATRIX44 m, MATRIX44 d)
inverts m and stores result in d

void g_matrix44_mult (MATRIX44 r, MATRIX44 m1, MATRIX44 m2)
r = m1 * m2

void g_matrix44_mult_vec3 (MATRIX44 m, VEC3 v)
v = m * v

void g_matrix44_mult_vec4 (MATRIX44 m, VEC4 v)
v = m * v, where v is of the type VEC3 or VEC4

void g_matrix44_mult_vec4_vec4 (MATRIX44 m, VEC4 v, VEC4 w)
w = m * v

void g_matrix44_proj_vec3 (VEC3 u, MATRIX44 m, VEC3 v)
multiply (v,1) with the matrix m, divide the first three components of the result by the fourth and return them in u

void g_matrix44_set_identity (MATRIX44 m)
m = identity matrix

void g_matrix44_transp (MATRIX44 m, MATRIX44 t)
transposes m and stores result in t

int g_solve2 (double a[2][2],VEC2 b,VEC2 x)
int g_solve3 (MATRIX33 a,VEC3 b,VEC3 x)
int g_solve4 (MATRIX44 a,VEC4 b,VEC4 x)
find x with a*x = b, return 1 of ok. g_solve3 is using a slow algorithm.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.