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

Comparing ray/src/ot/o_cone.c (file contents):
Revision 2.5 by greg, Tue Jun 14 17:10:06 2005 UTC vs.
Revision 2.7 by greg, Thu Apr 21 00:40:35 2016 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   #include  "octree.h"
12   #include  "object.h"
13   #include  "cone.h"
14 + #include  "plocate.h"
15  
16 + #ifndef STRICT
17 + #define STRICT  1
18 + #endif
19 +
20   #define  ROOT3          1.732050808
21  
22   /*
# Line 36 | Line 41 | static int findcseg(FVECT ep0, FVECT ep1, CONE *co, FV
41   extern int
42   o_cone(         /* determine if cone intersects cube */
43          OBJREC  *o,
44 <        register CUBE  *cu
44 >        CUBE  *cu
45   )
46   {
47          CONE  *co;
48          FVECT  ep0, ep1;
49 < #ifdef STRICT
49 > #if STRICT
50          FVECT  cumin, cumax;
51          CUBE  cukid;
52 <        register int  j;
52 >        int  j;
53   #endif
54          double  r;
55          FVECT  p;
56 <        register int  i;
56 >        int  i;
57                                          /* get cone arguments */
58          co = getcone(o, 0);
59 +        if (co == NULL)                 /* check for degenerate case */
60 +                return(O_MISS);
61                                          /* get cube center */
62          r = cu->cusize * 0.5;
63          for (i = 0; i < 3; i++)
# Line 61 | Line 68 | o_cone(                /* determine if cone intersects cube */
68                                          /* check min. distance to cone */
69                  if (dist2lseg(p, ep0, ep1) > (r+FTINY)*(r+FTINY))
70                          return(O_MISS);
71 < #ifdef  STRICT
71 > #if  STRICT
72                                          /* get cube boundaries */
73                  for (i = 0; i < 3; i++)
74                          cumax[i] = (cumin[i] = cu->cuorg[i]) + cu->cusize;
# Line 96 | Line 103 | static int
103   findcseg(       /* find line segment from cone closest to p */
104          FVECT  ep0,
105          FVECT  ep1,
106 <        register CONE  *co,
106 >        CONE  *co,
107          FVECT  p
108   )
109   {
110          double  d;
111          FVECT  v;
112 <        register int  i;
112 >        int  i;
113                                          /* find direction from axis to point */
114          VSUB(v, p, CO_P0(co));
115          d = DOT(v, co->ad);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines