14 #include "TPolyLine.h"
20 #include "PointCoordinates.h"
21 #include "RboxPoints.h"
22 #include "QhullError.h"
25 #include "QhullFacet.h"
26 #include "QhullFacetList.h"
27 #include "QhullFacetSet.h"
28 #include "QhullLinkedList.h"
29 #include "QhullVertex.h"
31 #include "QhullVertexSet.h"
34 #include <nanoflann.hpp>
35 #include "KDTreeVectorOfVectorsAdaptor.h"
42 typedef KDTreeVectorOfVectorsAdaptor<std::vector<std::vector<double>>> KDTree;
65 Voronoi(
const std::vector<std::vector<double>>& points,
66 const bool bounded=
true,
67 const double alpha=0.,
68 const double eps=1e-6);
80 void Initialize(
const double alpha,
const double eps);
113 double SimplexVolume(
const std::vector<double>& point)
const;
119 std::vector<TPolyLine*>
Polygons()
const;
131 void Draw(std::string name=
"",
134 bool axes=
false)
const;
Data stucture of a convex hull.
Definition: Hull.hh:25
const std::vector< double > & GetPoint(const size_t i) const
Returns a specific vertex.
Definition: Voronoi.hh:92
std::vector< double > _upper
Upper bounds in each dimension.
Definition: Voronoi.hh:143
const std::vector< Hull > & GetCellArray() const
Returns the array of cells corresponding to the array of vertice.
Definition: Voronoi.hh:95
void Initialize(const double alpha, const double eps)
Find the Voronoi tessellation of the N points.
Definition: Voronoi.cc:53
const bool & IsBounded() const
Returns true if box points have been added.
Definition: Voronoi.hh:104
std::vector< double > _lower
Lower bounds in each dimension.
Definition: Voronoi.hh:142
double SimplexVolume(const std::vector< double > &point) const
Returns the volume of a simplex in the current space.
Definition: Voronoi.cc:379
void Initialize1D(const double alpha, const double eps)
Find the Voronoi tessellation of the N points in 1D (special case)
Definition: Voronoi.cc:257
std::vector< Hull > _cells
Voronoi cells (subhulls)
Definition: Voronoi.hh:140
const Hull & GetCell(const size_t i) const
Returns a specific cell.
Definition: Voronoi.hh:98
KDTree * _kdtree
k-d Tree of the points to find NNs
Definition: Voronoi.hh:144
std::vector< TPolyLine * > Polygons() const
Returns an array of polygons to be drawn in ROOT (only 2D)
Definition: Voronoi.cc:425
Voronoi()
Default constructor, initilizes everything to 0.
Definition: Voronoi.cc:3
const std::vector< std::vector< double > > & GetPointArray() const
Returns the array of points on which the triangulation is constructed.
Definition: Voronoi.hh:89
std::vector< std::vector< double > > _points
Vector of N points.
Definition: Voronoi.hh:139
Computes the Voronoi tessellation of a set of points.
Definition: Voronoi.hh:53
const size_t GetNpoints() const
Returns the array of points on which the triangulation is constructed.
Definition: Voronoi.hh:86
const size_t & GetDimension() const
Returns the dimension of the tesselated space.
Definition: Voronoi.hh:101
Voronoi & operator=(const Voronoi &vor)
Equality operator.
Definition: Voronoi.cc:26
void Draw(std::string name="", bool color=true, bool points=false, bool axes=false) const
Draws the Voronoi tesselation on a canvas.
Definition: Voronoi.cc:485
size_t GetBestCellID(const std::vector< double > &v) const
Finds the closest cell and returns its hull.
Definition: Voronoi.cc:362
size_t _dim
Dimension of the space.
Definition: Voronoi.hh:138
const Hull & GetBestCell(const std::vector< double > &v) const
Finds the closest cell and returns its hull.
Definition: Voronoi.cc:373
bool _bounded
Switch to bound the points.
Definition: Voronoi.hh:141
TPolyLine * BoundingBox() const
Returns a rectangle to be drawn in ROOT (only 2D)
Definition: Voronoi.cc:401
TH2Poly * DensityProfile() const
Returns a histogram where each bin is a cell and its content is its density.
Definition: Voronoi.cc:439
~Voronoi()
Destructor.
Definition: Voronoi.cc:48