KrisLibrary  1.0.0
Arrangement1D.h
1 #ifndef ARRANGEMENT_1D_H
2 #define ARRANGEMENT_1D_H
3 
4 #include <map>
5 #include <list>
6 #include <vector>
8 
9 namespace Geometry {
10 
11  using namespace Math;
12  using namespace std;
13 
19 {
20  public:
21  typedef pair<Real,Real> Interval;
22  typedef list<int> IDList;
23  struct LeftInterval {
24  Interval interval;
25  IDList pointIDs; //id list of left endpoint
26  IDList intervalIDs; //id list of interval
27  };
28  typedef map<Real,LeftInterval> SortedIntervals;
29 
30  Arrangement1D();
31  void Insert(Real imin,Real imax,int id);
32  void InsertUnique(Real imin,Real imax,int id);
33  void GetIntervals(vector<Interval>& intervals,vector<const IDList*>& ids) const;
34  void GetAllIntervals(vector<Interval>& intervals,vector<const IDList*>& ids) const;
35  void GetOverlapIntervals(Real imin,Real imax,vector<Interval>& intervals,vector<const IDList*>& ids) const;
36 
37  //helpers
38  SortedIntervals::iterator LocateInterval(Real x);
39  SortedIntervals::const_iterator LocateInterval(Real x) const;
40  void Split(SortedIntervals::iterator interval,Real x);
41 
42  SortedIntervals intervals;
43 };
44 
45 } //namespace Geometry
46 
47 #endif
Common math typedefs, constants, functions.
Definition: rayprimitives.h:132
An arrangement of 1-D intervals. Intervals identified by an integer ID.
Definition: Arrangement1D.h:18
Definition: Arrangement1D.h:23
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
Contains all definitions in the Geometry package.
Definition: AnyGeometry.cpp:26