LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ConvexHull.h
Go to the documentation of this file.
1 
9 #ifndef ConvexHull_h
10 #define ConvexHull_h
11 
12 // Algorithm includes
14 
15 // std includes
16 #include <list>
17 #include <algorithm>
18 //------------------------------------------------------------------------------------------------------------------------------------------
19 
20 namespace lar_cluster3d
21 {
26 {
27 public:
31  using Point = std::tuple<float,float,const reco::ClusterHit3D*>;
32  using PointList = std::list<Point>;
33  using PointPair = std::pair<Point,Point>;
34  using MinMaxPointPair = std::pair<PointPair,PointPair>;
35 
41  ConvexHull(const PointList&);
42 
46  virtual ~ConvexHull();
47 
51  const PointList& getPointsList() {return fPoints;}
52 
56  const PointList& getConvexHull() const {return fConvexHull;}
57 
62 
66  float getConvexHullArea() const {return fConvexHullArea;}
67 
71  PointPair findNearestEdge(const Point&, float&) const;
72 
76  float findNearestDistance(const Point&) const;
77 
78 private:
79 
85  void getConvexHull(const PointList&);
86 
90  float crossProduct(const Point& p0, const Point& p1, const Point& p2) const;
91 
95  float Area() const;
96 
100  bool isLeft(const Point& p0, const Point& p1, const Point& pCheck) const;
101 
106 
107 };
108 
109 } // namespace lar_cluster3d
110 #endif
const PointList & getPointsList()
recover the list of points used to build convex hull
Definition: ConvexHull.h:51
std::pair< PointPair, PointPair > MinMaxPointPair
Definition: ConvexHull.h:34
MinMaxPointPair fMinMaxPointPair
Definition: ConvexHull.h:104
std::list< Point > PointList
Definition: ConvexHull.h:32
float crossProduct(const Point &p0, const Point &p1, const Point &p2) const
Gets the cross product of line from p0 to p1 and p0 to p2.
Definition: ConvexHull.cxx:56
std::pair< Point, Point > PointPair
Definition: ConvexHull.h:33
const MinMaxPointPair & getMinMaxPointPair() const
find the ends of the convex hull (along its x axis)
Definition: ConvexHull.h:61
float Area() const
Computes the area of the enclosed convext hull.
Definition: ConvexHull.cxx:69
std::tuple< float, float, const reco::ClusterHit3D * > Point
Definitions used by the ConvexHull algorithm.
Definition: ConvexHull.h:31
PointPair findNearestEdge(const Point &, float &) const
Given an input Point, find the nearest edge.
Definition: ConvexHull.cxx:194
float findNearestDistance(const Point &) const
Given an input point, find the distance to the nearest edge/point.
Definition: ConvexHull.cxx:255
float getConvexHullArea() const
recover the area of the convex hull
Definition: ConvexHull.h:66
const PointList & getConvexHull() const
recover the list of convex hull vertices
Definition: ConvexHull.h:56
ConvexHull class definiton.
Definition: ConvexHull.h:25
bool isLeft(const Point &p0, const Point &p1, const Point &pCheck) const
Determines whether a point is to the left, right or on line specifiec by p0 and p1.
Definition: ConvexHull.cxx:47
const PointList & fPoints
Definition: ConvexHull.h:102
ConvexHull(const PointList &)
Constructor.
Definition: ConvexHull.cxx:28
virtual ~ConvexHull()
Destructor.
Definition: ConvexHull.cxx:41