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

Comparing ray/src/common/clip.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:00:44 1991 UTC vs.
Revision 2.2 by greg, Sun Dec 19 22:49:28 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1993 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14  
15   #include  "plocate.h"
16  
17 + #define MAXITER         6       /* maximum possible number of iterations */
18  
19 +
20   clip(ep1, ep2, min, max)        /* clip a line segment to a box */
21   FLOAT  *ep1, *ep2;
22   FVECT  min, max;
23   {
24 +        int  itlim = MAXITER;
25          int  loc1, loc2;
26          int  accept;
27          FLOAT  *dp;
# Line 41 | Line 44 | FVECT  min, max;
44          
45          while (!((accept = !(loc1 | loc2)) || (loc1 & loc2))) {
46          
47 +                if (itlim-- <= 0)       /* past theoretical limit? */
48 +                        return(0);      /* quit fooling around */
49 +
50                  if (!loc1) {            /* make sure first point is outside */
51                          dp = ep1; ep1 = ep2; ep2 = dp;
52                          i = loc1; loc1 = loc2; loc2 = i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines