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

Comparing ray/src/rt/sphere.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:10:00 1991 UTC vs.
Revision 2.2 by greg, Sat Oct 24 08:15:32 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 43 | Line 43 | register RAY  *r;
43           *  quadratic equation in t is then solved for the
44           *  smallest positive root, which is our point of
45           *  intersection.
46 <         *      Because the ray direction is normalized, a is always 1.
46 >         *      Since the ray is normalized, a should always be
47 >         *  one.  We compute it here to prevent instability in the
48 >         *  intersection calculation.
49           */
50 <
51 <        a = 1.0;                /* compute quadratic coefficients */
50 <        b = c = 0.0;
50 >                                /* compute quadratic coefficients */
51 >        a = b = c = 0.0;
52          for (i = 0; i < 3; i++) {
53 +                a += r->rdir[i]*r->rdir[i];
54                  t = r->rorg[i] - ap[i];
55                  b += 2.0*r->rdir[i]*t;
56                  c += t*t;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines