LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
SweepEvent.h
Go to the documentation of this file.
1 
9 #ifndef Event_h
10 #define Event_h
11 
12 // Get the beach line definitions
14 
15 // Algorithm includes
17 
18 // std includes
19 #include <vector>
20 #include <list>
21 #include <algorithm>
22 //------------------------------------------------------------------------------------------------------------------------------------------
23 
24 namespace voronoi2d
25 {
29 class SiteEvent : public dcel2d::Point, virtual public IEvent
30 {
35 public:
36  SiteEvent(const dcel2d::Point& point) : dcel2d::Point(point), m_valid(true), m_node(NULL)
37  {
38  m_coords = dcel2d::Coords(std::get<0>(point),std::get<1>(point),0.);
39  }
41 
42  void setInvalid() const override {m_valid = false;}
43  void setBSTNode(BSTNode* node) override {m_node = node;}
44 
45  bool isSite() const override {return std::get<2>(*this) != NULL;}
46  bool isCircle() const override {return std::get<2>(*this) == NULL;}
47  bool isValid() const override {return m_valid;}
48  const dcel2d::Point& getPoint() const override {return *this;}
49  double xPos() const override {return m_coords[0];}
50  double yPos() const override {return m_coords[1];}
51  const dcel2d::Coords& getCoords() const override {return m_coords;}
52  const dcel2d::Coords& circleCenter() const override {return m_coords;}
53  BSTNode* getBSTNode() const override {return m_node;}
54 
55  bool operator<(const IEvent& right) const override {return xPos() < right.xPos();}
56 private:
58  mutable bool m_valid;
60 };
61 
62 class CircleEvent : public dcel2d::Point, virtual public IEvent
63 {
69 public:
70  CircleEvent(const dcel2d::Point& point, const dcel2d::Coords& center) :
71  dcel2d::Point(point),
72  m_valid(true),
73  m_node(NULL)
74  {
75  m_circleCenter = center;
76  }
78 
79  void setInvalid() const override {m_valid = false;}
80  void setBSTNode(BSTNode* node) override {m_node = node;}
81 
82  bool isSite() const override {return std::get<2>(*this) != NULL;}
83  bool isCircle() const override {return std::get<2>(*this) == NULL;}
84  bool isValid() const override {return m_valid;}
85  const dcel2d::Point& getPoint() const override {return *this;}
86  double xPos() const override {return std::get<0>(*this);}
87  double yPos() const override {return std::get<1>(*this);}
88  const dcel2d::Coords& getCoords() const override {return m_circleCenter;}
89  const dcel2d::Coords& circleCenter() const override {return m_circleCenter;}
90  BSTNode* getBSTNode() const override {return m_node;}
91 
92  bool operator<(const IEvent& right) const override {return xPos() < right.xPos();}
93 private:
95  mutable bool m_valid;
97 };
98 
99 using SiteEventList = std::list<SiteEvent>;
100 using CircleEventList = std::list<CircleEvent>;
101 
102 } // namespace lar_cluster3d
103 #endif
const dcel2d::Coords & circleCenter() const override
Definition: SweepEvent.h:52
double yPos() const override
Definition: SweepEvent.h:50
const dcel2d::Point & getPoint() const override
Definition: SweepEvent.h:85
BSTNode * getBSTNode() const override
Definition: SweepEvent.h:90
double xPos() const override
Definition: SweepEvent.h:49
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
Internal class definitions to facilitate construction of diagram.
Definition: SweepEvent.h:29
bool isSite() const override
Definition: SweepEvent.h:82
Definition: DCEL.h:27
std::list< SiteEvent > SiteEventList
Definition: SweepEvent.h:99
void setInvalid() const override
Interface for configuring the particular algorithm tool.
Definition: SweepEvent.h:79
std::list< CircleEvent > CircleEventList
Definition: SweepEvent.h:100
BSTNode class definiton specifically for use in constructing Voronoi diagrams. We are trying to follo...
Definition: BeachLine.h:32
BSTNode * getBSTNode() const override
Definition: SweepEvent.h:53
const dcel2d::Point & getPoint() const override
Definition: SweepEvent.h:48
SiteEvent(const dcel2d::Point &point)
This defines "Site" events which are generated from the input points. This implements the "IEvent" in...
Definition: SweepEvent.h:36
bool isCircle() const override
Definition: SweepEvent.h:46
bool isCircle() const override
Definition: SweepEvent.h:83
double xPos() const override
Definition: SweepEvent.h:86
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:88
void setInvalid() const override
Interface for configuring the particular algorithm tool.
Definition: SweepEvent.h:42
bool isValid() const override
Definition: SweepEvent.h:47
void setBSTNode(BSTNode *node) override
Definition: SweepEvent.h:80
const dcel2d::Coords & circleCenter() const override
Definition: SweepEvent.h:89
bool isValid() const override
Definition: SweepEvent.h:84
dcel2d::Coords m_circleCenter
Definition: SweepEvent.h:94
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
void setBSTNode(BSTNode *node) override
Definition: SweepEvent.h:43
bool isSite() const override
Definition: SweepEvent.h:45
virtual double xPos() const =0
double yPos() const override
Definition: SweepEvent.h:87
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:55
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:92
Eigen::Vector3f Coords
Definition: DCEL.h:36
CircleEvent(const dcel2d::Point &point, const dcel2d::Coords &center)
This defines "Circle" events which are generated during the "sweep" of the beach line and define when...
Definition: SweepEvent.h:70
dcel2d::Coords m_coords
Definition: SweepEvent.h:57
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:51