Sets of Intervalsinterval_set can be used to store a collection
objects of an arbitrary
type I together with closed intervals of double numbers
as keys. The elements of a interval_set are of type is_item .
Strengths
ExampleThe following example shows how #include <LEDA/geo/interval_set.h> #include <LEDA/core/string.h> using namespace leda; int main() { interval_set<string> IS; IS.insert(1,10,"a"); IS.insert(2,21,"b"); IS.insert(3,4,"c"); IS.insert(120,120,"d"); std::cout << "Lookup (3,4):"; is_item isit=IS.lookup(3,4); if (isit!=nil) std::cout << "(" << IS.left(isit) << "," << IS.right(isit) << "," << IS.inf(isit) << ")\n"; std::cout << "\nIntersection with (5,21):\n"; list<is_item> L=IS.intersection(5,21); forall(isit,L) { std::cout << "(" << IS.left(isit) << "," << IS.right(isit) << "," << IS.inf(isit) << ")\n"; } return 0; } |
See also:Associating Information with Geometric Objects Manual Entries: |