--- ray/src/common/dircode.c 2003/03/12 04:59:04 2.3 +++ ray/src/common/dircode.c 2003/06/27 06:53:21 2.7 @@ -1,13 +1,13 @@ #ifndef lint -static const char RCSid[] = "$Id: dircode.c,v 2.3 2003/03/12 04:59:04 greg Exp $"; +static const char RCSid[] = "$Id: dircode.c,v 2.7 2003/06/27 06:53:21 greg Exp $"; #endif /* - * Compute a 4-byte direction code (int4 type defined in standard.h). + * Compute a 4-byte direction code (externals defined in rtmath.h). * * Mean accuracy is 0.0022 degrees, with a maximum error of 0.0058 degrees. */ -#include "standard.h" +#include "rtmath.h" #define DCSCALE 11585.2 /* (1<<13)*sqrt(2) */ #define FXNEG 01 @@ -19,20 +19,22 @@ static const char RCSid[] = "$Id: dircode.c,v 2.3 2003 #define F2SFT 18 #define FMASK 0x1fff -int4 +int32 encodedir(dv) /* encode a normalized direction vector */ FVECT dv; { - register int4 dc = 0; + register int32 dc = 0; int cd[3], cm; register int i; for (i = 0; i < 3; i++) if (dv[i] < 0.) { - cd[i] = dv[i] * -DCSCALE; + cd[i] = (int)(dv[i] * -DCSCALE); dc |= FXNEG<>F1SFT & FMASK)+.5)*(1./DCSCALE); d2 = ((dc>>F2SFT & FMASK)+.5)*(1./DCSCALE); der = sqrt(1. - d1*d1 - d2*d2); @@ -77,7 +83,7 @@ register int4 dc; double dir2diff(dc1, dc2) /* approx. radians^2 between directions */ -int4 dc1, dc2; +int32 dc1, dc2; { FVECT v1, v2; @@ -90,7 +96,7 @@ int4 dc1, dc2; double fdir2diff(dc1, v2) /* approx. radians^2 between directions */ -int4 dc1; +int32 dc1; register FVECT v2; { FVECT v1;