home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- +
- + LEDA 2.1.1 11-15-1991
- +
- +
- + point_set.h
- +
- +
- + Copyright (c) 1991 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 6600 Saarbruecken, FRG
- + All rights reserved.
- +
- *******************************************************************************/
-
-
-
-
-
- #ifndef POINTSETH
- #define POINTSETH
-
- #include <LEDA/d2_dictionary.h>
- #include <LEDA/plane.h>
- #include <LEDA/delaunay_tree.h>
-
-
- typedef DT_item ps_item;
-
- typedef list(DT_item) list(ps_item);
-
-
- declare3(d2_dictionary,real,real,DT_item)
-
-
-
- class Point_Set : public delaunay_tree {
-
- d2_dictionary(real,real,DT_item) T;
-
- public:
-
- Point_Set() {}
-
- ps_item lookup(point);
-
- list(ps_item) range_search(real, real, real, real);
-
- list(point) all_points();
-
- ps_item insert(point p, void* i);
-
- ps_item nearest_neighbor(point p){ return delaunay_tree::neighbor(p); }
-
- void change_inf(ps_item it, void* i) { delaunay_tree::change_inf(it,i);}
-
- void del(point p) { delaunay_tree::del(p);
- T.del(p.xcoord(),p.ycoord());
- }
-
- void del_item(ps_item it) { del(key(it)); }
-
- list(ps_item) all_items();
- list(ps_item) convex_hull();
-
-
- void clear() { T.clear(); delaunay_tree::clear(); }
- int size() { return T.size(); }
- bool empty() { return T.empty(); }
-
-
- };
-
-
- #define point_set(itype) name2(itype,point_set)
-
-
- #define point_setdeclare(itype)\
- \
- class point_set(itype) : public Point_Set {\
- \
- void clear_inf(ent& x) { Clear(*(itype*)&x); }\
- void copy_inf(ent& x) { Copy(*(itype*)&x); }\
- \
- public:\
- \
- void change_inf(ps_item it, itype i) { Point_Set::change_inf(it,Ent(i)); }\
- itype inf(ps_item it) { return itype(Point_Set::inf(it)); }\
- ps_item insert(point p, itype i) { return Point_Set::insert(p,Ent(i));}\
- \
- point_set(itype)() {}\
- ~point_set(itype)() { clear(); }\
- };
-
- #define forall_ps_items(i,D) forall(i, (D.all_items()) )
-
- #endif
-
-