libmove3d
3.13.0
|
#include <gpConvexHull.h>
Public Member Functions | |
gpConvexHull () | |
gpConvexHull (const std::vector< std::vector< double > > &points) | |
int | setPoints (const std::vector< std::vector< double > > &points) |
unsigned int | nbVertices () |
unsigned int | nbFaces () |
int | pointCoordinates (unsigned int i, std::vector< double > &coord) |
int | compute (bool simplicial_facets, double postMergingCentrumRadius, bool verbose=true) |
virtual int | voronoi (bool verbose=true) |
int | draw () |
int | drawFace (unsigned int face_index) |
int | print () |
double | largest_ball_radius () |
int | isPointInside (std::vector< double > point, bool &inside, double &distance) |
Public Attributes | |
std::vector< unsigned int > | hull_vertices |
std::vector< gpFace > | hull_faces |
the hull faces (arrays containing indices to elements of the point set). | |
std::vector< std::vector < double > > | voronoi_vertices_ |
for voronoi regions computation: | |
std::vector< gpVoronoiRidge > | voronoi_ridges_ |
std::vector< gpVoronoiCell > | voronoi_cells_ |
Protected Member Functions | |
int | reset () |
Protected Attributes | |
unsigned int | dimension_ |
bool | up_to_date_ |
space dimension (size of the point vectors) | |
std::vector< std::vector < double > > | points_ |
double | largest_ball_radius_ |
This class is used to compute the convex hull (or the voronoi regions) of a set of points in arbitrary dimension (via Qhull library). Special 3D and 6D case has a specific class (see below). Set the point set at creation or with setPoints() and then call compute() to compute the convex hull or voronoi() to compute the voronoi regions.
gpConvexHull::gpConvexHull | ( | ) |
Default constructor of the class gpConvexHull. All is left void.
int gpConvexHull::compute | ( | bool | simplicial_facets, |
double | postMergingCentrumRadius, | ||
bool | verbose = true |
||
) |
Computes the convex hull of the point set stored in the calling gpConvexHull variable. The user can choose to have simplicial or non-simplicial output facets and to enable/disable post-merging of nearly coplanar facets.
simplicial_facets | selects wether the computed facets will be simplicial or not |
postMergingCentrumRadius | centrum radius for post-merging: merges facets when the centrum is less than the given value from a neighboring hyperplane. This allows Qhull to merge the hull facets that are adjacent and nearly coplanar. Set postMergingCentrumRadius to a negative or null value to disable post-merging. |
verbose | selects if Qhull will print its messages in the console or not |
int gpConvexHull::isPointInside | ( | std::vector< double > | point, |
bool & | inside, | ||
double & | distance | ||
) |
Tests if a given point is inside the convex hull. If it is the case, the function also gives the distance from the points to the hull.
point | the point's coordinates |
result | true if the point is inside, false otherwise |
distance | true if the point is inside, false otherwise |
double gpConvexHull::largest_ball_radius | ( | ) |
Returns the radius of the largest ball centered on the origin and fully contained in the hull. The function compute() must have been called before.
int gpConvexHull::pointCoordinates | ( | unsigned int | i, |
std::vector< double > & | coord | ||
) |
Gets the coordinates of the i-th input point used for convex hull computation.
i | index of a point in the input point array (starts from 0) |
coord | where to copy the coordinates of the point |
int gpConvexHull::print | ( | ) |
Prints the content of the current convex hull.
int gpConvexHull::reset | ( | ) | [protected] |
Reinitializes everything.
int gpConvexHull::setPoints | ( | const std::vector< std::vector< double > > & | points | ) |
int gpConvexHull::voronoi | ( | bool | verbose = true | ) | [virtual] |
Computes the voronoi regions of the point set stored in the calling gpConvexHull variable. The function does not read into Qhulll's internal data but redirects Qhull's output into a temporary file and read into this file.
verbose | selects if Qhull will print its messages in the console or not |
Reimplemented in gpConvexHull3D.
std::vector<unsigned int> gpConvexHull::hull_vertices |
the hull vertices (indices to elements of the point set)
double gpConvexHull::largest_ball_radius_ [protected] |
the radius of the largest sphere centered on the origin and fully contained in the convex hull (it is null if the hull does not contain the origin):
std::vector< std::vector<double> > gpConvexHull::points_ [protected] |
the input set of points
bool gpConvexHull::up_to_date_ [protected] |
space dimension (size of the point vectors)
flag to tell wether or not the current content of hull_vertices and hull_faces corresponds to the actual convex hull of the current point set