LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
SweepEvent.h
Go to the documentation of this file.
1 
9 #ifndef Event_h
10 #define Event_h
11 
12 // LArSoft includes
15 namespace voronoi2d {
16  class BSTNode;
17 }
18 
19 // std includes
20 #include <list>
21 #include <tuple>
22 
23 // Eigen includes
24 #include <Eigen/Core>
25 
26 //------------------------------------------------------------------------------------------------------------------------------------------
27 
28 namespace voronoi2d {
32  class SiteEvent : public dcel2d::Point, virtual public IEvent {
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 
58  private:
60  mutable bool m_valid;
62  };
63 
64  class CircleEvent : public dcel2d::Point, virtual public IEvent {
70  public:
71  CircleEvent(const dcel2d::Point& point, const dcel2d::Coords& center)
72  : dcel2d::Point(point), m_valid(true), m_node(NULL)
73  {
74  m_circleCenter = center;
75  }
77 
78  void setInvalid() const override { m_valid = false; }
79  void setBSTNode(BSTNode* node) override { m_node = node; }
80 
81  bool isSite() const override { return std::get<2>(*this) != NULL; }
82  bool isCircle() const override { return std::get<2>(*this) == NULL; }
83  bool isValid() const override { return m_valid; }
84  const dcel2d::Point& getPoint() const override { return *this; }
85  double xPos() const override { return std::get<0>(*this); }
86  double yPos() const override { return std::get<1>(*this); }
87  const dcel2d::Coords& getCoords() const override { return m_circleCenter; }
88  const dcel2d::Coords& circleCenter() const override { return m_circleCenter; }
89  BSTNode* getBSTNode() const override { return m_node; }
90 
91  bool operator<(const IEvent& right) const override { return xPos() < right.xPos(); }
92 
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:53
double yPos() const override
Definition: SweepEvent.h:51
const dcel2d::Point & getPoint() const override
Definition: SweepEvent.h:84
BSTNode * getBSTNode() const override
Definition: SweepEvent.h:89
double xPos() const override
Definition: SweepEvent.h:50
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
Internal class definitions to facilitate construction of diagram.
Definition: SweepEvent.h:32
bool isSite() const override
Definition: SweepEvent.h:81
std::list< SiteEvent > SiteEventList
Definition: SweepEvent.h:99
void setInvalid() const override
Interface for configuring the particular algorithm tool.
Definition: SweepEvent.h:78
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:34
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:82
double xPos() const override
Definition: SweepEvent.h:85
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:87
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:79
const dcel2d::Coords & circleCenter() const override
Definition: SweepEvent.h:88
bool isValid() const override
Definition: SweepEvent.h:83
dcel2d::Coords m_circleCenter
Definition: SweepEvent.h:94
void setBSTNode(BSTNode *node) override
Definition: SweepEvent.h:44
bool isSite() const override
Definition: SweepEvent.h:46
virtual double xPos() const =0
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:42
double yPos() const override
Definition: SweepEvent.h:86
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:56
bool operator<(const IEvent &right) const override
Definition: SweepEvent.h:91
Eigen::Vector3f Coords
Definition: DCEL.h:44
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:59
const dcel2d::Coords & getCoords() const override
Definition: SweepEvent.h:52