1 |
greg |
1.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 |
greg |
1.2 |
#include "fvect.h" |
14 |
|
|
|
15 |
greg |
1.1 |
#include "plocate.h" |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
int |
19 |
|
|
plocate(p, min, max) /* return location of p w.r.t. min & max */ |
20 |
greg |
1.2 |
register FVECT p; |
21 |
|
|
FVECT min, max; |
22 |
greg |
1.1 |
{ |
23 |
|
|
register int loc = 0; |
24 |
|
|
|
25 |
|
|
if (p[0] < min[0] - EPSILON) |
26 |
|
|
loc |= XPOS & BELOW; |
27 |
|
|
else if (p[0] > max[0] + EPSILON) |
28 |
|
|
loc |= XPOS & ABOVE; |
29 |
|
|
if (p[1] < min[1] - EPSILON) |
30 |
|
|
loc |= YPOS & BELOW; |
31 |
|
|
else if (p[1] > max[1] + EPSILON) |
32 |
|
|
loc |= YPOS & ABOVE; |
33 |
|
|
if (p[2] < min[2] - EPSILON) |
34 |
|
|
loc |= ZPOS & BELOW; |
35 |
|
|
else if (p[2] > max[2] + EPSILON) |
36 |
|
|
loc |= ZPOS & ABOVE; |
37 |
|
|
|
38 |
|
|
return(loc); |
39 |
|
|
} |