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.7 by schorsch, Tue Mar 30 16:13:01 2004 UTC vs.
Revision 2.10 by greg, Thu Mar 16 00:25:24 2023 UTC

# Line 12 | Line 12 | static const char RCSid[] = "$Id$";
12   #include  "rtotypes.h"
13  
14  
15 < extern int
15 > int
16   o_sphere(                       /* compute intersection with sphere */
17          OBJREC  *so,
18 <        register RAY  *r
18 >        RAY  *r
19   )
20   {
21          double  a, b, c;        /* coefficients for quadratic equation */
22          double  root[2];        /* quadratic roots */
23          int  nroots;
24          double  t;
25 <        register RREAL  *ap;
26 <        register int  i;
25 >        RREAL  *ap;
26 >        int  i;
27  
28          if (so->oargs.nfargs != 4)
29                  objerror(so, USER, "bad # arguments");
# Line 63 | Line 63 | o_sphere(                      /* compute intersection with sphere */
63                          break;
64          if (i >= nroots)
65                  return(0);                      /* no positive root */
66 <
67 <        if (t >= r->rot)
68 <                return(0);                      /* other is closer */
66 >        if (rayreject(so, r, t, 0))
67 >                return(0);                      /* previous hit better */
68  
69          r->ro = so;
70          r->rot = t;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines