ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/plocate.c
Revision: 1.1
Committed: Thu Feb 2 10:33:05 1989 UTC (35 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# Content
1 /* Copyright (c) 1986 Regents of the University of California */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ LBL";
5 #endif
6
7 /*
8 * plocate.c - routine to locate 3D vector w.r.t. box.
9 *
10 * 8/28/85
11 */
12
13 #include "plocate.h"
14
15
16 int
17 plocate(p, min, max) /* return location of p w.r.t. min & max */
18 register double p[3];
19 double min[3], max[3];
20 {
21 register int loc = 0;
22
23 if (p[0] < min[0] - EPSILON)
24 loc |= XPOS & BELOW;
25 else if (p[0] > max[0] + EPSILON)
26 loc |= XPOS & ABOVE;
27 if (p[1] < min[1] - EPSILON)
28 loc |= YPOS & BELOW;
29 else if (p[1] > max[1] + EPSILON)
30 loc |= YPOS & ABOVE;
31 if (p[2] < min[2] - EPSILON)
32 loc |= ZPOS & BELOW;
33 else if (p[2] > max[2] + EPSILON)
34 loc |= ZPOS & ABOVE;
35
36 return(loc);
37 }