--- ray/src/common/invmat4.c 1994/04/12 15:20:48 2.1 +++ ray/src/common/invmat4.c 2003/02/25 02:47:21 2.3 @@ -1,15 +1,14 @@ -/* Copyright (c) 1994 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: invmat4.c,v 2.3 2003/02/25 02:47:21 greg Exp $"; #endif - /* * invmat4 - computes the inverse of mat into inverse. Returns 1 * if there exists an inverse, 0 otherwise. It uses Gaussian Elimination * method. */ +#include "copyright.h" + #include "mat4.h" @@ -18,7 +17,8 @@ static char SCCSid[] = "$SunId$ LBL"; #define SWAP(a,b,t) (t=a,a=b,b=t) -invmat4(inverse,mat) +int +invmat4(inverse, mat) MAT4 inverse, mat; { MAT4 m4tmp; @@ -27,9 +27,7 @@ MAT4 inverse, mat; copymat4(m4tmp, mat); /* set inverse to identity */ - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - inverse[i][j] = i==j ? 1.0 : 0.0; + setident4(inverse); for(i = 0; i < 4; i++) { /* Look for row with largest pivot and swap rows */