Back to index

radiance  4R0+20100331
plocate.c
Go to the documentation of this file.
00001 #ifndef lint
00002 static const char    RCSid[] = "$Id: plocate.c,v 2.3 2003/02/25 02:47:21 greg Exp $";
00003 #endif
00004 /*
00005  *  plocate.c - routine to locate 3D vector w.r.t. box.
00006  */
00007 
00008 #include "copyright.h"
00009 
00010 #include  "fvect.h"
00011 
00012 #include  "plocate.h"
00013 
00014 
00015 int
00016 plocate(p, min, max)        /* return location of p w.r.t. min & max */
00017 register FVECT  p;
00018 FVECT  min, max;
00019 {
00020        register int  loc = 0;
00021 
00022        if (p[0] < min[0] - EPSILON)
00023               loc |= XPOS & BELOW;
00024        else if (p[0] > max[0] + EPSILON)
00025               loc |= XPOS & ABOVE;
00026        if (p[1] < min[1] - EPSILON)
00027               loc |= YPOS & BELOW;
00028        else if (p[1] > max[1] + EPSILON)
00029               loc |= YPOS & ABOVE;
00030        if (p[2] < min[2] - EPSILON)
00031               loc |= ZPOS & BELOW;
00032        else if (p[2] > max[2] + EPSILON)
00033               loc |= ZPOS & ABOVE;
00034        
00035        return(loc);
00036 }