12 |
|
|
13 |
|
#include "mat4.h" |
14 |
|
|
15 |
+ |
MAT4 m4ident = MAT4IDENT; |
16 |
+ |
|
17 |
|
static MAT4 m4tmp; /* for efficiency */ |
18 |
|
|
19 |
|
|
18 |
– |
setident4(m4) |
19 |
– |
MAT4 m4; |
20 |
– |
{ |
21 |
– |
static MAT4 ident = { |
22 |
– |
1.,0.,0.,0., |
23 |
– |
0.,1.,0.,0., |
24 |
– |
0.,0.,1.,0., |
25 |
– |
0.,0.,0.,1., |
26 |
– |
}; |
27 |
– |
copymat4(m4, ident); |
28 |
– |
} |
29 |
– |
|
30 |
– |
|
20 |
|
multmat4(m4a, m4b, m4c) /* multiply m4b X m4c and put into m4a */ |
21 |
|
MAT4 m4a; |
22 |
|
register MAT4 m4b, m4c; |
61 |
|
} |
62 |
|
|
63 |
|
|
75 |
– |
#ifdef INVMAT |
64 |
|
/* |
65 |
|
* invmat - computes the inverse of mat into inverse. Returns 1 |
66 |
|
* if there exists an inverse, 0 otherwise. It uses Gaussian Elimination |
77 |
|
register double temp; |
78 |
|
|
79 |
|
copymat4(m4tmp, mat); |
80 |
< |
setident(inverse); |
80 |
> |
setident4(inverse); |
81 |
|
|
82 |
|
for(i = 0; i < 4; i++) { |
83 |
|
/* Look for row with largest pivot and swap rows */ |
115 |
|
#undef ABS |
116 |
|
#undef SWAP |
117 |
|
} |
130 |
– |
#endif |