ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/fvect.c
(Generate patch)

Comparing ray/src/common/fvect.c (file contents):
Revision 2.15 by greg, Thu Sep 6 00:07:43 2012 UTC vs.
Revision 2.17 by greg, Thu Nov 22 06:07:17 2012 UTC

# Line 195 | Line 195 | int meas               /* distance measure (radians, absolute, rela
195   )
196   {
197          FVECT   normtarg;
198 <        double  volen, dotprod, sint, cost;
198 >        double  volen, dotprod, sintr, cost;
199          int     i;
200  
201 +        VCOPY(normtarg, vtarg);         /* in case vtarg==vres */
202          if (vres != vorig)
203                  VCOPY(vres, vorig);
204          if (t == 0.0)
205                  return(VLEN(vres));     /* no rotation requested */
206          if ((volen = normalize(vres)) == 0.0)
207                  return(0.0);
207        VCOPY(normtarg, vtarg);
208          if (normalize(normtarg) == 0.0)
209                  return(0.0);            /* target vector is zero */
210          dotprod = DOT(vres, normtarg);
# Line 222 | Line 222 | int meas               /* distance measure (radians, absolute, rela
222          else if (meas == GEOD_REL)
223                  t *= acos(dotprod);
224          cost = cos(t);
225 <        sint = sin(t);
225 >        sintr = sin(t) / sqrt(1. - dotprod*dotprod);
226          for (i = 0; i < 3; i++)
227                  vres[i] = volen*( cost*vres[i] +
228 <                                  sint*(normtarg[i] - dotprod*vres[i]) );
228 >                                  sintr*(normtarg[i] - dotprod*vres[i]) );
229  
230          return(volen);                  /* return vector length */
231   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines