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 1.2 by greg, Wed Apr 19 22:24:30 1989 UTC vs.
Revision 1.5 by greg, Wed Oct 23 13:43:48 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 23 | Line 23 | register RAY  *r;
23          double  root[2];        /* quadratic roots */
24          int  nroots;
25          double  t;
26 <        register double  *ap;
26 >        register FLOAT  *ap;
27          register int  i;
28  
29 <        if (so->oargs.nfargs != 4 || so->oargs.farg[3] <= FTINY)
30 <                objerror(so, USER, "bad arguments");
31 <
29 >        if (so->oargs.nfargs != 4)
30 >                objerror(so, USER, "bad # arguments");
31          ap = so->oargs.farg;
32 +        if (ap[3] < -FTINY) {
33 +                objerror(so, WARNING, "negative radius");
34 +                so->otype = so->otype == OBJ_SPHERE ?
35 +                                OBJ_BUBBLE : OBJ_SPHERE;
36 +                ap[3] = -ap[3];
37 +        } else if (ap[3] <= FTINY)
38 +                objerror(so, USER, "zero radius");
39  
40          /*
41           *      We compute the intersection by substituting into
# Line 71 | Line 77 | register RAY  *r;
77                  r->ron[i] = (r->rop[i] - ap[i]) / a;
78          }
79          r->rod = -DOT(r->rdir, r->ron);
80 <        r->rofs = 1.0; setident4(r->rofx);
75 <        r->robs = 1.0; setident4(r->robx);
80 >        r->rox = NULL;
81  
82          return(1);                      /* hit */
83   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines