ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/plocate.c
Revision: 2.3
Committed: Tue Feb 25 02:47:21 2003 UTC (21 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1, rad5R3, HEAD
Changes since 2.2: +1 -56 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 greg 2.2 static const char RCSid[] = "$Id$";
3 greg 1.1 #endif
4     /*
5     * plocate.c - routine to locate 3D vector w.r.t. box.
6 greg 2.2 */
7    
8 greg 2.3 #include "copyright.h"
9 greg 1.1
10 greg 1.2 #include "fvect.h"
11    
12 greg 1.1 #include "plocate.h"
13    
14    
15     int
16     plocate(p, min, max) /* return location of p w.r.t. min & max */
17 greg 1.2 register FVECT p;
18     FVECT min, max;
19 greg 1.1 {
20     register int loc = 0;
21    
22     if (p[0] < min[0] - EPSILON)
23     loc |= XPOS & BELOW;
24     else if (p[0] > max[0] + EPSILON)
25     loc |= XPOS & ABOVE;
26     if (p[1] < min[1] - EPSILON)
27     loc |= YPOS & BELOW;
28     else if (p[1] > max[1] + EPSILON)
29     loc |= YPOS & ABOVE;
30     if (p[2] < min[2] - EPSILON)
31     loc |= ZPOS & BELOW;
32     else if (p[2] > max[2] + EPSILON)
33     loc |= ZPOS & ABOVE;
34    
35     return(loc);
36     }