SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Attributes
Voronoi Class Reference

Computes the Voronoi tessellation of a set of points. More...

#include <Voronoi.hh>

Public Member Functions

 Voronoi ()
 Default constructor, initilizes everything to 0. More...
 
 Voronoi (const std::vector< std::vector< double >> &points, const bool bounded=true, const double alpha=0., const double eps=1e-6)
 Cloud constructor, sets the vector of points. More...
 
 Voronoi (const Voronoi &vor)
 Copy constructor. More...
 
Voronoi & operator= (const Voronoi &vor)
 Equality operator. More...
 
 ~Voronoi ()
 Destructor. More...
 
void Initialize (const double alpha, const double eps)
 Find the Voronoi tessellation of the N points. More...
 
void Initialize1D (const double alpha, const double eps)
 Find the Voronoi tessellation of the N points in 1D (special case) More...
 
const size_t GetNpoints () const
 Returns the array of points on which the triangulation is constructed. More...
 
const std::vector< std::vector
< double > > & 
GetPointArray () const
 Returns the array of points on which the triangulation is constructed. More...
 
const std::vector< double > & GetPoint (const size_t i) const
 Returns a specific vertex. More...
 
const std::vector< Hull > & GetCellArray () const
 Returns the array of cells corresponding to the array of vertice. More...
 
const Hull & GetCell (const size_t i) const
 Returns a specific cell. More...
 
const size_t & GetDimension () const
 Returns the dimension of the tesselated space. More...
 
const bool & IsBounded () const
 Returns true if box points have been added. More...
 
size_t GetBestCellID (const std::vector< double > &v) const
 Finds the closest cell and returns its hull. More...
 
const Hull & GetBestCell (const std::vector< double > &v) const
 Finds the closest cell and returns its hull. More...
 
double SimplexVolume (const std::vector< double > &point) const
 Returns the volume of a simplex in the current space. More...
 
TPolyLine * BoundingBox () const
 Returns a rectangle to be drawn in ROOT (only 2D) More...
 
std::vector< TPolyLine * > Polygons () const
 Returns an array of polygons to be drawn in ROOT (only 2D) More...
 
TH2Poly * DensityProfile () const
 Returns a histogram where each bin is a cell and its content is its density. More...
 
void Draw (std::string name="", bool color=true, bool points=false, bool axes=false) const
 Draws the Voronoi tesselation on a canvas. More...
 

Private Attributes

size_t _dim
 Dimension of the space. More...
 
std::vector< std::vector
< double > > 
_points
 Vector of N points. More...
 
std::vector< Hull > _cells
 Voronoi cells (subhulls) More...
 
bool _bounded
 Switch to bound the points. More...
 
std::vector< double > _lower
 Lower bounds in each dimension. More...
 
std::vector< double > _upper
 Upper bounds in each dimension. More...
 
KDTree * _kdtree
 k-d Tree of the points to find NNs More...
 

Detailed Description

Computes the Voronoi tessellation of a set of points.

The Voronoi tessellation is obtained by computing the (n+1)-dimensional convex hull of the points by adding the L2 vector norm as an additional coordinate. This forms a paraboloid which projected bottom end corresponds to the Delaunay triangulation. The Voronoi tessellation is the dual graph of the Delaunay triangulation.

Qhull performs the heavy lifting, this is a front end class.

Constructor & Destructor Documentation

Voronoi::Voronoi ( )

Default constructor, initilizes everything to 0.

Voronoi::Voronoi ( const std::vector< std::vector< double >> &  points,
const bool  bounded = true,
const double  alpha = 0.,
const double  eps = 1e-6 
)

Cloud constructor, sets the vector of points.

Parameters
pointsN points in a _dim dimensional space
boundedAdd 2^_dim box points to contain the tessellation
alphaPenalised Centroidal Voronoi Tessellation parameter
epsPrecision required for the pure CVT (alpha = 1.)
Voronoi::Voronoi ( const Voronoi &  vor)

Copy constructor.

Voronoi::~Voronoi ( )

Destructor.

Member Function Documentation

TPolyLine * Voronoi::BoundingBox ( ) const

Returns a rectangle to be drawn in ROOT (only 2D)

TH2Poly * Voronoi::DensityProfile ( ) const

Returns a histogram where each bin is a cell and its content is its density.

void Voronoi::Draw ( std::string  name = "",
bool  color = true,
bool  points = false,
bool  axes = false 
) const

Draws the Voronoi tesselation on a canvas.

Parameters
nameWill print the canvas as "VT_name.pdf"
colorImplements a color scale inverse proportional to the cell volume
pointsDraws the points on which the tesselation is constructed
axesDraws axes
const Hull & Voronoi::GetBestCell ( const std::vector< double > &  v) const

Finds the closest cell and returns its hull.

size_t Voronoi::GetBestCellID ( const std::vector< double > &  v) const

Finds the closest cell and returns its hull.

const Hull& Voronoi::GetCell ( const size_t  i) const
inline

Returns a specific cell.

const std::vector<Hull>& Voronoi::GetCellArray ( ) const
inline

Returns the array of cells corresponding to the array of vertice.

const size_t& Voronoi::GetDimension ( ) const
inline

Returns the dimension of the tesselated space.

const size_t Voronoi::GetNpoints ( ) const
inline

Returns the array of points on which the triangulation is constructed.

const std::vector<double>& Voronoi::GetPoint ( const size_t  i) const
inline

Returns a specific vertex.

const std::vector<std::vector<double> >& Voronoi::GetPointArray ( ) const
inline

Returns the array of points on which the triangulation is constructed.

void Voronoi::Initialize ( const double  alpha,
const double  eps 
)

Find the Voronoi tessellation of the N points.

void Voronoi::Initialize1D ( const double  alpha,
const double  eps 
)

Find the Voronoi tessellation of the N points in 1D (special case)

const bool& Voronoi::IsBounded ( ) const
inline

Returns true if box points have been added.

Voronoi & Voronoi::operator= ( const Voronoi &  vor)

Equality operator.

std::vector< TPolyLine * > Voronoi::Polygons ( ) const

Returns an array of polygons to be drawn in ROOT (only 2D)

double Voronoi::SimplexVolume ( const std::vector< double > &  point) const

Returns the volume of a simplex in the current space.

Field Documentation

bool Voronoi::_bounded
private

Switch to bound the points.

std::vector<Hull> Voronoi::_cells
private

Voronoi cells (subhulls)

size_t Voronoi::_dim
private

Dimension of the space.

KDTree* Voronoi::_kdtree
private

k-d Tree of the points to find NNs

std::vector<double> Voronoi::_lower
private

Lower bounds in each dimension.

std::vector<std::vector<double> > Voronoi::_points
private

Vector of N points.

std::vector<double> Voronoi::_upper
private

Upper bounds in each dimension.


The documentation for this class was generated from the following files: