SweepEvent.h
Go to the documentation of this file.
1 /**
2  * @file Event.h
3  *
4  * @brief Represents the Event implemented as a self balancing binary search tree
5  *
6  * @author usher@slac.stanford.edu
7  *
8  */
9 #ifndef Event_h
10 #define Event_h
11 
12 // LArSoft includes
15 namespace voronoi2d { class BSTNode; }
16 
17 // std includes
18 #include <list>
19 #include <tuple>
20 
21 // Eigen includes
22 #include <Eigen/Core>
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
26 namespace voronoi2d
27 {
28 /**
29  * @brief Internal class definitions to facilitate construction of diagram
30  */
31 class SiteEvent : public dcel2d::Point, virtual public IEvent
32 {
33  /**
34  * @brief This defines "Site" events which are generated from the
35  * input points. This implements the "IEvent" interface
36  */
37 public:
38  SiteEvent(const dcel2d::Point& point) : dcel2d::Point(point), m_valid(true), m_node(NULL)
39  {
40  m_coords = dcel2d::Coords(std::get<0>(point),std::get<1>(point),0.);
41  }
42 
43  void setInvalid() const override {m_valid = false;}
44  void setBSTNode(BSTNode* node) override {m_node = node;}
45 
46  bool isSite() const override {return std::get<2>(*this) != NULL;}
47  bool isCircle() const override {return std::get<2>(*this) == NULL;}
48  bool isValid() const override {return m_valid;}
49  const dcel2d::Point& getPoint() const override {return *this;}
50  double xPos() const override {return m_coords[0];}
51  double yPos() const override {return m_coords[1];}
52  const dcel2d::Coords& getCoords() const override {return m_coords;}
53  const dcel2d::Coords& circleCenter() const override {return m_coords;}
54  BSTNode* getBSTNode() const override {return m_node;}
55 
56  bool operator<(const IEvent& right) const override {return xPos() < right.xPos();}
57 private:
59  mutable bool m_valid;
61 };
62 
63 class CircleEvent : public dcel2d::Point, virtual public IEvent
64 {
65  /**
66  * @brief This defines "Circle" events which are generated during the
67  * "sweep" of the beach line and define when an arc on the
68  * beach line will disappear
69  */
70 public:
72  dcel2d::Point(point),
73  m_valid(true),
74  m_node(NULL)
75  {
76  m_circleCenter = center;
77  }
79 
80  void setInvalid() const override {m_valid = false;}
81  void setBSTNode(BSTNode* node) override {m_node = node;}
82 
83  bool isSite() const override {return std::get<2>(*this) != NULL;}
84  bool isCircle() const override {return std::get<2>(*this) == NULL;}
85  bool isValid() const override {return m_valid;}
86  const dcel2d::Point& getPoint() const override {return *this;}
87  double xPos() const override {return std::get<0>(*this);}
88  double yPos() const override {return std::get<1>(*this);}
89  const dcel2d::Coords& getCoords() const override {return m_circleCenter;}
90  const dcel2d::Coords& circleCenter() const override {return m_circleCenter;}
91  BSTNode* getBSTNode() const override {return m_node;}
92 
93  bool operator<(const IEvent& right) const override {return xPos() < right.xPos();}
94 private:
96  mutable bool m_valid;
98 };
99 
100 using SiteEventList = std::list<SiteEvent>;
101 using CircleEventList = std::list<CircleEvent>;
102 
103 } // namespace lar_cluster3d
104 #endif
const dcel2d::Coords & circleCenter() const override
Definition: SweepEvent.h:53
double yPos() const override
Definition: SweepEvent.h:51
const dcel2d::Point & getPoint() const override
Definition: SweepEvent.h:86
BSTNode * getBSTNode() const override
Definition: SweepEvent.h:91
double xPos() const override
Definition: SweepEvent.h:50
Internal class definitions to facilitate construction of diagram.
Definition: SweepEvent.h:31
bool isSite() const override
Definition: SweepEvent.h:83
std::list< SiteEvent > SiteEventList
Definition: SweepEvent.h:100
void setInvalid() const override
Interface for configuring the particular algorithm tool.
Definition: SweepEvent.h:80
std::list< CircleEvent > CircleEventList
Definition: SweepEvent.h:101
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:54
const dcel2d::Point & getPoint() const override
Definition: SweepEvent.h:49
SiteEvent(const dcel2d::Point &point)
This defines "Site" events which are generated from the input points. This implements the "IEvent" in...
Definition: SweepEvent.h:38
bool isCircle() const override
Definition: SweepEvent.h:47
bool isCircle() const override
Definition: SweepEvent.h:84
double xPos() const override
Definition: SweepEvent.h:87
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:89
void setInvalid() const override
Interface for configuring the particular algorithm tool.
Definition: SweepEvent.h:43
bool isValid() const override
Definition: SweepEvent.h:48
void setBSTNode(BSTNode *node) override
Definition: SweepEvent.h:81
const dcel2d::Coords & circleCenter() const override
Definition: SweepEvent.h:90
bool isValid() const override
Definition: SweepEvent.h:85
dcel2d::Coords m_circleCenter
Definition: SweepEvent.h:95
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:44
void setBSTNode(BSTNode *node) override
Definition: SweepEvent.h:44
bool isSite() const override
Definition: SweepEvent.h:46
virtual double xPos() const =0
double yPos() const override
Definition: SweepEvent.h:88
def center(depos, point)
Definition: depos.py:117
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:56
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:93
Eigen::Vector3f Coords
Definition: DCEL.h:46
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:71
dcel2d::Coords m_coords
Definition: SweepEvent.h:58
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:52