Aim: Provides a set of functions to facilitate the computation of convex hulls and polytopes, as well as shortcuts to build cell complex representing a Delaunay complex.
More...
#include <DGtal/geometry/volumes/ConvexityHelper.h>
|
|
static LatticePolytope | computeLatticePolytope (const PointRange &input_points, bool remove_duplicates=true, bool make_minkowski_summable=false) |
|
static PointRange | computeConvexHullVertices (const PointRange &input_points, bool remove_duplicates=true) |
|
template<typename TSurfaceMesh > |
static bool | computeConvexHullBoundary (TSurfaceMesh &mesh, const PointRange &input_points, bool remove_duplicates=true) |
|
static bool | computeConvexHullBoundary (PolygonalSurface< Point > &polysurf, const PointRange &input_points, bool remove_duplicates=true) |
|
static bool | computeConvexHullCellComplex (ConvexCellComplex< Point > &cell_complex, const PointRange &input_points, bool remove_duplicates=true) |
|
static LatticePolytope | computeSimplex (const PointRange &input_points, bool remove_duplicates=true) |
|
static LatticePolytope | computeDegeneratedLatticePolytope (PointRange &input_points) |
|
static PointRange | computeDegeneratedConvexHullVertices (PointRange &input_points) |
|
static LatticePolytope | compute3DTriangle (const Point &a, const Point &b, const Point &c, bool make_minkowski_summable=false) |
|
static LatticePolytope | computeDegeneratedTriangle (const Point &a, const Point &b, const Point &c) |
|
static LatticePolytope | computeSegment (const Point &a, const Point &b) |
|
|
static bool | computeDelaunayCellComplex (ConvexCellComplex< Point > &cell_complex, const PointRange &input_points, bool remove_duplicates=true) |
|
|
static RationalPolytope | computeRationalPolytope (const std::vector< RealPoint > &input_points, Integer denominator, bool remove_duplicates=true, bool make_minkowski_summable=false) |
|
template<typename TSurfaceMesh > |
static bool | computeConvexHullBoundary (TSurfaceMesh &mesh, const std::vector< RealPoint > &input_points, double precision=1024.0, bool remove_duplicates=true) |
|
static bool | computeConvexHullBoundary (PolygonalSurface< RealPoint > &polysurf, const std::vector< RealPoint > &input_points, double precision=1024.0, bool remove_duplicates=true) |
|
static bool | computeConvexHullCellComplex (ConvexCellComplex< RealPoint > &cell_complex, const std::vector< RealPoint > &input_points, double precision=1024.0, bool remove_duplicates=true) |
|
|
static bool | computeDelaunayCellComplex (ConvexCellComplex< RealPoint > &cell_complex, const std::vector< RealPoint > &input_points, double precision=1024.0, bool remove_duplicates=true) |
|
|
template<typename QHull > |
static void | computeFacetAndRidgeVertices (const QHull &hull, std::vector< IndexRange > &cell_vertices, std::map< typename QHull::Ridge, Index > &r2f, std::vector< IndexRange > &face_vertices) |
|
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
struct DGtal::ConvexityHelper< dim, TInteger, TInternalInteger >
Aim: Provides a set of functions to facilitate the computation of convex hulls and polytopes, as well as shortcuts to build cell complex representing a Delaunay complex.
Description of template class 'ConvexityHelper'
- Template Parameters
-
dim | the dimension of the space where points and further objects live. |
TInteger | the integral type used to define the digital space, a model of concepts::CInteger. It sets the coordinate type of input lattice points as well as output integral convex hulls and lattice polytopes. |
TInternalInteger | the integer type that is used for internal computations of above/below plane tests, a model of concepts::CInteger. Must be at least as precise as TCoordinateInteger. |
- See also
- QuickHull algorithm in arbitrary dimension for convex hull and Delaunay cell complex computation
- Examples
- geometry/tools/exampleLatticeBallDelaunay3D.cpp, geometry/tools/exampleQuickHull3D.cpp, geometry/tools/exampleRationalBallDelaunay3D.cpp, geometry/volumes/exampleBoundedLatticePolytopeCount2D.cpp, geometry/volumes/exampleBoundedLatticePolytopeCount3D.cpp, and geometry/volumes/exampleBoundedLatticePolytopeCount4D.cpp.
Definition at line 164 of file ConvexityHelper.h.
◆ Index
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ IndexRange
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ Integer
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ InternalInteger
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ LatticeConvexHullKernel
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ LatticeDelaunayKernel
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ LatticePolytope
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ Point
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ PointRange
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ RationalPolytope
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ RealConvexHullKernel
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ RealDelaunayKernel
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ RealPoint
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ RealVector
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ Size
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ Space
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ Vector
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ BOOST_CONCEPT_ASSERT() [1/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ BOOST_CONCEPT_ASSERT() [2/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ BOOST_STATIC_ASSERT()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
◆ compute3DTriangle()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the lattice polytope enclosing a triangle in dimension 3. Takes care of degeneracies (non distinct points or alignment).
- Parameters
-
| a | any point |
| b | any point |
| c | any point |
[in] | make_minkowski_summable | Other constraints are added so that we can perform axis aligned Minkowski sums on this polytope. Useful for checking full convexity (see moduleDigitalConvexity). |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points.
◆ computeConvexHullBoundary() [1/4]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes a polygonal surface representation of the boundary of the convex hull of the given lattice points.
- Note
- Since it builds a surface, this method is thus 3D.
- Parameters
-
[out] | polysurf | the output polygonal surface that represents the boundary of the convex hull of the given range of points. Its euler characteristic should be 0 in even dimension, 2 in odd dimension. |
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output surface is correct, otherwise return 'false'.
◆ computeConvexHullBoundary() [2/4]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes a polygonal surface representation of the boundary of the rational polytope that approximates the convex hull of the given real points.
- Note
- Since it builds a surface, this method is thus 3D.
- Parameters
-
[out] | polysurf | the output polygonal surface mesh that represents the boundary of the convex hull of the given range of points. |
[in] | input_points | the range of input real points. |
[in] | precision | the scaling factor that is used to multiply each real coordinate before rounding it to an integer, a kind of common denominator if you think of the result as a rational number. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output mesh is correct, otherwise return 'false'.
◆ computeConvexHullBoundary() [3/4]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
template<typename TSurfaceMesh >
static bool DGtal::ConvexityHelper< dim, TInteger, TInternalInteger >::computeConvexHullBoundary |
( |
TSurfaceMesh & | mesh, |
|
|
const PointRange & | input_points, |
|
|
bool | remove_duplicates = true ) |
|
static |
Computes a surface mesh representation of the boundary of the convex hull of the given lattice points.
- Note
- Since it builds a surface, this method is thus 3D.
- Template Parameters
-
TSurfaceMesh | any model of surface that can be initialized with a range of input positions (cast as real coordinates) and a range of index ranges giving for each face its range of incident vertices. For instance, you may use class SurfaceMesh. |
- Parameters
-
[out] | mesh | the output surface mesh that represents the boundary of the convex hull of the given range of points. |
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output mesh is correct, otherwise return 'false'.
◆ computeConvexHullBoundary() [4/4]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
template<typename TSurfaceMesh >
static bool DGtal::ConvexityHelper< dim, TInteger, TInternalInteger >::computeConvexHullBoundary |
( |
TSurfaceMesh & | mesh, |
|
|
const std::vector< RealPoint > & | input_points, |
|
|
double | precision = 1024.0, |
|
|
bool | remove_duplicates = true ) |
|
static |
Computes a surface mesh representation of the boundary of the rational polytope that approximates the convex hull of the given real points.
- Note
- Since it builds a surface, this method is thus 3D.
- Template Parameters
-
TSurfaceMesh | any model of surface that can be initialized with a range of input positions (cast as real coordinates) and a range of index ranges giving for each face its range of incident vertices. For instance, you may use class SurfaceMesh. |
- Parameters
-
[out] | mesh | the output surface mesh that represents the boundary of the convex hull of the given range of points. |
[in] | input_points | the range of input real points. |
[in] | precision | the scaling factor that is used to multiply each real coordinate before rounding it to an integer, a kind of common denominator if you think of the result as a rational number. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output mesh is correct, otherwise return 'false'.
◆ computeConvexHullCellComplex() [1/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes a cell complex representing the convex hull of the given lattice points, formed of one maximal dimension cell and as many cells of codimension 1 as the number of facets of the convex hull.
- Parameters
-
[out] | cell_complex | the output cell complex that represents the convex hull of the given lattice points. |
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output complex is correct, otherwise return 'false'.
◆ computeConvexHullCellComplex() [2/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes a cell complex representing the convex hull of the given real points, formed of one maximal dimension cell and as many cells of codimension 1 as the number of facets of the convex hull.
- Parameters
-
[out] | cell_complex | the output cell complex that represents the convex hull of the given real points. |
[in] | input_points | the range of input real points. |
[in] | precision | the scaling factor that is used to multiply each real coordinate before rounding it to an integer, a kind of common denominator if you think of the result as a rational number. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output complex is correct, otherwise return 'false'.
◆ computeConvexHullVertices()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes and returns the vertices of the tightiest lattice polytope enclosing all the given input lattice points.
- Parameters
-
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- the vertices of the tightiest bounded lattice polytope including the given range of points, or an empty range if the dimension is greater than 3 and the given range of points is not full.
◆ computeDegeneratedConvexHullVertices()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the vertices of the tightiest lattice polytope enclosing a range of distinct points, arranged such that they do not form a full dimensional polytope.
- Note
- Called internally by ConvexityHelper::computeLatticePolytopeVertices.
-
This function works for dimension no greater than 3.
- Parameters
-
[in,out] | input_points | a range of distinct points, which may be changed by the method. More precisely a point may be added (in 3D) to complete the set of points so that it forms a full dimensional polytope. |
- Returns
- the vertices of the tightiest bounded lattice polytope including the given range of points, or an empty set of vertices if the given range of points was not full dimensional and dimension was greater than 3.
◆ computeDegeneratedLatticePolytope()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the lattice polytope enclosing a range of distinct points, arranged such that they do not form a full dimensional polytope.
- Note
- Called internally by ConvexityHelper::computeLatticePolytope and ConvexityHelper::computeSimplex.
-
This function works for dimension no greater than 3.
- Parameters
-
[in,out] | input_points | a range of distinct points, which may be changed by the method. More precisely a point may be added (in 3D) to complete the set of points so that it forms a full dimensional polytope. |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points, or an empty polytope if the given range of points was not full dimensional and dimension was greater than 3.
◆ computeDegeneratedTriangle()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the lattice polytope enclosing a degenerated triangle. The points must be aligned (or non distinct).
- Parameters
-
a | any point |
b | any point |
c | any point |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points.
◆ computeDelaunayCellComplex() [1/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the Delaunay cell complex associated to the given range of input points.
- Parameters
-
[out] | cell_complex | the output cell complex that represents the Delaunay complex of the given lattice points. |
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output complex is correct, otherwise return 'false'.
- Note
- The Delaunay cell complex may not be simplicial if some points are cospherical.
Referenced by main().
◆ computeDelaunayCellComplex() [2/2]
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the Delaunay cell complex associated to the given range of input real points.
- Parameters
-
[out] | cell_complex | the output cell complex that represents the Delaunay complex of the given lattice points. |
[in] | input_points | the range of input real points. |
[in] | precision | the scaling factor that is used to multiply each real coordinate before rounding it to an integer, a kind of common denominator if you think of the result as a rational number. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- 'true' if the input points were full dimensional and the output complex is correct, otherwise return 'false'.
- Note
- The Delaunay cell complex may not be simplicial if some points are cospherical.
◆ computeFacetAndRidgeVertices()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
template<typename QHull >
static void DGtal::ConvexityHelper< dim, TInteger, TInternalInteger >::computeFacetAndRidgeVertices |
( |
const QHull & | hull, |
|
|
std::vector< IndexRange > & | cell_vertices, |
|
|
std::map< typename QHull::Ridge, Index > & | r2f, |
|
|
std::vector< IndexRange > & | face_vertices ) |
|
static |
- Template Parameters
-
- Parameters
-
[in] | hull | a computed QuickHull object |
[out] | cell_vertices | the vector giving for each cell the indices of its vertices. |
[out] | r2f | the map giving for each ridge (i.e. the pair of cells defining each face) the index of its corresponding face. |
[out] | face_vertices | the vector giving for each face the indices of its vertices. |
- Precondition
hull.status() >= Status::VerticesCompleted
and hull.status() <= Status::AllCompleted
◆ computeLatticePolytope()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes and returns a halfspace representation of the tightiest lattice polytope enclosing all the given input lattice points.
- Parameters
-
[in] | input_points | the range of input lattice points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
[in] | make_minkowski_summable | Other constraints are added so that we can perform axis aligned Minkowski sums on this polytope. Useful for checking full convexity (see moduleDigitalConvexity). |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points, or an empty range if the dimension is greater than 3 and the given range of points is not full.
◆ computeRationalPolytope()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes and returns a halfspace representation of the tightiest rational polytope enclosing all the given input real points.
- Parameters
-
[in] | input_points | the range of input real points. |
[in] | denominator | the denominator used in all rational approximations of points with real value coordinates, the higher the more precise. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
[in] | make_minkowski_summable | Other constraints are added so that we can perform axis aligned Minkowski sums on this polytope. Useful for checking full convexity (see moduleDigitalConvexity). |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points, or an empty polytope if the given range of points was not full dimensional.
◆ computeSegment()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the lattice polytope enclosing a segment.
- Parameters
-
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points. It is always Minkowski summable.
◆ computeSimplex()
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
Computes the lattice polytope enclosing a range of at most dimension+1 distinct points.
- Note
- Called internally by ConvexityHelper::computeLatticePolytope.
-
This function works for arbitrary full dimensional simplex. If the set of points is not full dimensional, it is able to build a non full dimensional simplex for dimensions <= 3.
- Parameters
-
| input_points | a range of points, with at most dimension+1 distinct points. |
[in] | remove_duplicates | should be set to 'true' if the input data has duplicates. |
- Returns
- the tightiest bounded lattice polytope (i.e. H-representation) including the given range of points, or an empty polytope if the given range of points was not full dimensional and dimension was greater than 3.
◆ dimension
template<int dim, typename TInteger = DGtal::int32_t, typename TInternalInteger = DGtal::int64_t>
The documentation for this struct was generated from the following file: