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

Comparing ray/src/rt/o_face.c (file contents):
Revision 2.6 by greg, Thu Mar 2 16:51:55 2006 UTC vs.
Revision 2.9 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_face(         /* compute intersection with polygonal face */
17          OBJREC  *o,
18 <        register RAY  *r
18 >        RAY  *r
19   )
20   {
21          double  rdot;           /* direction . normal */
22          double  t;              /* distance to intersection */
23          FVECT  pisect;          /* intersection point */
24 <        register FACE  *f;      /* face record */
24 >        FACE  *f;       /* face record */
25  
26          f = getface(o);
27                  
28          /*
29           *  First, we find the distance to the plane containing the
30 <         *  face.  If this distance is less than zero or greater
31 <         *  than a previous intersection, we return.  Otherwise,
30 >         *  face.  If the plane is parallel to our ray, or the
31 >         *  previous hit was better, we return.  Otherwise,
32           *  we determine whether in fact the ray intersects the
33           *  face.  The ray intersects the face if the
34           *  point of intersection with the plane of the face
# Line 36 | Line 36 | o_face(                /* compute intersection with polygonal face *
36           */
37                                                  /* compute dist. to plane */
38          rdot = -DOT(r->rdir, f->norm);
39 <        if (rdot <= FTINY && rdot >= -FTINY)    /* ray parallels plane */
40 <                t = FHUGE;
41 <        else
42 <                t = (DOT(r->rorg, f->norm) - f->offset) / rdot;
39 >        if ((rdot <= FTINY) & (rdot >= -FTINY)) /* ray parallels plane */
40 >                return(0);
41 >
42 >        t = (DOT(r->rorg, f->norm) - f->offset) / rdot;
43          
44 <        if (t <= FTINY || t >= r->rot)          /* not good enough */
44 >        if (rayreject(o, r, t, rdot))           /* previous hit is better? */
45                  return(0);
46                                                  /* compute intersection */
47          VSUM(pisect, r->rorg, r->rdir, t);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines