home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / src / plane / _point_s.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.3 KB  |  68 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  2.1.1                                                 11-15-1991
  4. +
  5. +
  6. +  _point_set.c
  7. +
  8. +
  9. +  Copyright (c) 1991  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15.  
  16. #include <LEDA/point_set.h>
  17.  
  18. ps_item  Point_Set::insert(point p, void* i) 
  19. { ps_item it = delaunay_tree::insert(p,i);
  20.   T.insert(p.xcoord(),p.ycoord(),it);
  21.   return it;
  22.  }
  23.  
  24. list(point) Point_Set::all_points()
  25. { list(point) result;
  26.   list(ps_item)  L = all_items();
  27.   ps_item it;
  28.   forall(it,L) result.append(key(it));
  29.   return result;
  30. }
  31.  
  32.  
  33. ps_item Point_Set::lookup(point p)
  34. { double    x  = p.xcoord();
  35.   double    y  = p.ycoord();
  36.   dic2_item it = T.lookup(x,y);
  37.   return (it!=nil) ? T.inf(it) : nil;
  38. }
  39.  
  40. list(ps_item) Point_Set::range_search(real x0, real x1, real y0, real y1)
  41. {
  42.   list(dic2_item) Lr = T.range_search(x0,x1,y0,y1);
  43.  
  44.   list(ps_item) Lp;
  45.  
  46.   dic2_item it;
  47.  
  48.   forall(it,Lr) Lp.append(T.inf(it));
  49.  
  50.   return Lp;
  51.  
  52. }
  53.  
  54.  
  55. list(ps_item) Point_Set::all_items()          
  56. { list(ps_item) L; 
  57.   delaunay_tree::all_items(L); 
  58.   return L ; 
  59.  }
  60.  
  61.  
  62. list(ps_item) Point_Set::convex_hull()
  63. { list(ps_item) L; 
  64.   delaunay_tree::convex_hull(L);
  65.   return L;
  66.  }
  67.