--- ray/src/common/fvect.c 1991/03/19 13:14:19 1.5 +++ ray/src/common/fvect.c 1991/10/23 13:43:15 1.7 @@ -12,9 +12,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include "fvect.h" -#define FTINY 1e-7 - double fdot(v1, v2) /* return the dot product of two vectors */ register FVECT v1, v2; @@ -122,20 +120,20 @@ spinvector(vres, vorig, vnorm, theta) /* rotate vector FVECT vres, vorig, vnorm; double theta; { - extern double sin(), cos(); - double sint, cost, dotp; + extern double cos(), sin(); + double sint, cost, normprod; FVECT vperp; register int i; if (theta == 0.0) { - VCOPY(vres, vorig); + if (vres != vorig) + VCOPY(vres, vorig); return; } - sint = sin(theta); cost = cos(theta); - dotp = DOT(vorig, vnorm); + sint = sin(theta); + normprod = DOT(vorig, vnorm)*(1.-cost); fcross(vperp, vnorm, vorig); for (i = 0; i < 3; i++) - vres[i] = vnorm[i]*dotp*(1.-cost) + - vorig[i]*cost + vperp[i]*sint; + vres[i] = vorig[i]*cost + vnorm[i]*normprod + vperp[i]*sint; }