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

Comparing ray/src/rt/o_cone.c (file contents):
Revision 1.2 by greg, Wed Apr 19 22:24:25 1989 UTC vs.
Revision 2.6 by greg, Mon Jun 28 10:07:17 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1986 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  o_cone.c - routine to determine ray intersection with cones.
9 *
10 *     2/13/86
6   */
7  
8 < #include  "ray.h"
8 > #include "copyright.h"
9  
10 + #include  "ray.h"
11   #include  "otypes.h"
12 <
12 > #include  "rtotypes.h"
13   #include  "cone.h"
14  
15  
16 < o_cone(o, r)                    /* intersect ray with cone */
17 < OBJREC  *o;
18 < register RAY  *r;
16 > extern int
17 > o_cone(                 /* intersect ray with cone */
18 >        OBJREC  *o,
19 >        register RAY  *r
20 > )
21   {
22          FVECT  rox, rdx;
23          double  a, b, c;
# Line 86 | Line 84 | register RAY  *r;
84                          r->rop[i] = r->rorg[i] + r->rdir[i]*r->rot;
85                  VCOPY(r->ron, co->ad);
86                  r->rod = -rdx[2];
87 <                r->rofs = 1.0; setident4(r->rofx);
90 <                r->robs = 1.0; setident4(r->robx);
87 >                r->rox = NULL;
88                  return(1);                              /* good */
89          }
90                                          /* roots for cone, cup, cyl., tube */
# Line 130 | Line 127 | register RAY  *r;
127                          for (i = 0; i < 3; i++)
128                                  r->ron[i] = (co->al*r->ron[i] - c*co->ad[i])
129                                                  /co->sl;
130 +                a = DOT(r->ron, r->ron);
131 +                if (a > 1.+FTINY || a < 1.-FTINY) {
132 +                        c = 1./(.5 + .5*a);     /* avoid numerical error */
133 +                        r->ron[0] *= c; r->ron[1] *= c; r->ron[2] *= c;
134 +                }
135                  r->rod = -DOT(r->rdir, r->ron);
136 <                r->rofs = 1.0; setident4(r->rofx);
137 <                r->robs = 1.0; setident4(r->robx);
136 >                r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
137 >                r->uv[0] = r->uv[1] = 0.0;
138 >                r->rox = NULL;
139                  return(1);                      /* good */
140          }
141          return(0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines