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 1.1 by greg, Thu Feb 2 10:33:01 1989 UTC vs.
Revision 2.4 by greg, Tue Feb 25 02:47:21 2003 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   *  clip.c - routine to clip 3D line segments to a box.
9 *
10 *     8/28/85
6   */
7  
8 + #include "copyright.h"
9 +
10 + #include  "fvect.h"
11 +
12   #include  "plocate.h"
13  
14 + #define MAXITER         6       /* maximum possible number of iterations */
15  
16 +
17 + int
18   clip(ep1, ep2, min, max)        /* clip a line segment to a box */
19 < double  *ep1, *ep2;
20 < double  min[3], max[3];
19 > FLOAT  *ep1, *ep2;
20 > FVECT  min, max;
21   {
22 +        int  itlim = MAXITER;
23          int  loc1, loc2;
24          int  accept;
25 <        double  *dp;
25 >        FLOAT  *dp;
26          double  d;
27          register int  i, j;
28  
# Line 39 | Line 42 | double  min[3], max[3];
42          
43          while (!((accept = !(loc1 | loc2)) || (loc1 & loc2))) {
44          
45 +                if (itlim-- <= 0)       /* past theoretical limit? */
46 +                        return(0);      /* quit fooling around */
47 +
48                  if (!loc1) {            /* make sure first point is outside */
49                          dp = ep1; ep1 = ep2; ep2 = dp;
50                          i = loc1; loc1 = loc2; loc2 = i;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines