home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / NEWS / RADIANCE / SRC / OT / PLOCATE.C < prev    next >
C/C++ Source or Header  |  1993-10-07  |  794b  |  40 lines

  1. /* Copyright (c) 1986 Regents of the University of California */
  2.  
  3. #ifndef lint
  4. static char SCCSid[] = "@(#)plocate.c 2.1 11/12/91 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  "fvect.h"
  14.  
  15. #include  "plocate.h"
  16.  
  17.  
  18. int
  19. plocate(p, min, max)        /* return location of p w.r.t. min & max */
  20. register FVECT  p;
  21. FVECT  min, max;
  22. {
  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. }
  40.