DGtal  1.3.beta
ConvexityHelper.h
1 
17 #pragma once
18 
31 #if defined(ConvexityHelper_RECURSES)
32 #error Recursive header files inclusion detected in ConvexityHelper.h
33 #else // defined(ConvexityHelper_RECURSES)
34 
35 #define ConvexityHelper_RECURSES
36 
37 #if !defined ConvexityHelper_h
38 
39 #define ConvexityHelper_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <string>
45 #include <vector>
46 #include "DGtal/base/Common.h"
47 #include "DGtal/kernel/CInteger.h"
48 #include "DGtal/kernel/SpaceND.h"
49 #include "DGtal/geometry/tools/QuickHull.h"
50 #include "DGtal/geometry/volumes/BoundedLatticePolytope.h"
51 #include "DGtal/geometry/volumes/BoundedRationalPolytope.h"
52 #include "DGtal/geometry/volumes/ConvexCellComplex.h"
53 #include "DGtal/shapes/PolygonalSurface.h"
54 
55 namespace DGtal
56 {
57 
58  namespace detail {
59 
69  template < typename TIntegerCoordinate, bool safe >
71  typedef TIntegerCoordinate Type;
72  };
73 
79  template < >
81 #ifdef WITH_BIGINTEGER
83 #else
84  typedef DGtal::int64_t Type;
85 #endif
86  };
87 
93  template < >
96  };
97 
103  template < >
105 #ifdef WITH_BIGINTEGER
107 #else
108  typedef DGtal::int64_t Type;
109 #endif
110  };
111 
117  template < >
120  };
121 
122 #ifdef WITH_BIGINTEGER
123  template < bool safe >
134  };
135 #endif
136 
137  } // namespace detail
138 
140  // template class ConvexityHelper
161  template < int dim,
162  typename TInteger = DGtal::int32_t,
163  typename TInternalInteger = DGtal::int64_t >
165  BOOST_STATIC_ASSERT( dim > 1 );
166  // Integer must be a model of the concept CInteger.
168  // Integer must be a model of the concept CInteger.
170 
171  static const Dimension dimension = dim;
172 
173  typedef TInteger Integer;
174  typedef TInternalInteger InternalInteger;
176  typedef typename Space::Point Point;
177  typedef typename Space::Vector Vector;
178  typedef typename Space::RealPoint RealPoint;
179  typedef typename Space::RealVector RealVector;
180  typedef std::size_t Size;
181  typedef std::size_t Index;
182  typedef std::vector< Index > IndexRange;
193 
194  // ----------------- lattice convex hull services -------------------------
195  public:
198 
216  static
218  computeLatticePolytope( const std::vector< Point >& input_points,
219  bool remove_duplicates = true,
220  bool make_minkowski_summable = false );
221 
222 
223 
245  template < typename TSurfaceMesh >
246  static
247  bool
248  computeConvexHullBoundary( TSurfaceMesh& mesh,
249  const std::vector< Point >& input_points,
250  bool remove_duplicates = true );
251 
269  static
270  bool
272  const std::vector< Point >& input_points,
273  bool remove_duplicates = true );
274 
290  static
291  bool
293  const std::vector< Point >& input_points,
294  bool remove_duplicates = true );
295 
316  static
318  computeSimplex( const std::vector< Point >& input_points,
319  bool remove_duplicates = true );
320 
340  static
342  computeDegeneratedLatticePolytope( std::vector< Point > & input_points );
343 
344 
346 
347  // ----------------- lattice Delaunay services -------------------------
348  public:
351 
368  static
369  bool
371  const std::vector< Point >& input_points,
372  bool remove_duplicates = true );
373 
375 
376  // ----------------- rational convex hull services -------------------------
377  public:
380 
402  static
404  computeRationalPolytope( const std::vector< RealPoint >& input_points,
405  Integer denominator,
406  bool remove_duplicates = true,
407  bool make_minkowski_summable = false );
408 
435  template < typename TSurfaceMesh >
436  static
437  bool
438  computeConvexHullBoundary( TSurfaceMesh& mesh,
439  const std::vector< RealPoint >& input_points,
440  double precision = 1024.0,
441  bool remove_duplicates = true );
442 
463  static
464  bool
466  const std::vector< RealPoint >& input_points,
467  double precision = 1024.0,
468  bool remove_duplicates = true );
469 
490  static
491  bool
493  const std::vector< RealPoint >& input_points,
494  double precision = 1024.0,
495  bool remove_duplicates = true );
496 
498 
499 
500  // ----------------- real Delaunay services -------------------------
501  public:
504 
526  static
527  bool
529  const std::vector< RealPoint >& input_points,
530  double precision = 1024.0,
531  bool remove_duplicates = true );
532 
534 
535  // ----------------- utility services -------------------------
536  public:
539 
555  template < typename QHull >
556  static
557  void
558  computeFacetAndRidgeVertices( const QHull& hull,
559  std::vector< IndexRange >& cell_vertices,
560  std::map< typename QHull::Ridge, Index >& r2f,
561  std::vector< IndexRange >& face_vertices );
562 
564 
565  }; // class ConvexityHelper
566 
567 
568 } // namespace DGtal
569 
571 // Includes inline functions.
572 #include "ConvexityHelper.ih"
573 
574 // //
576 
577 #endif // !defined ConvexityHelper_h
578 
579 #undef ConvexityHelper_RECURSES
580 #endif // else defined(ConvexityHelper_RECURSES)
DGtal::BigInteger
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
DGtal::DelaunayIntegralKernel
Aim: a geometric kernel to compute the Delaunay triangulation of digital points with integer-only ari...
Definition: QuickHullKernels.h:508
DGtal::ConvexityHelper::computeConvexHullCellComplex
static bool computeConvexHullCellComplex(ConvexCellComplex< Point > &cell_complex, const std::vector< Point > &input_points, bool remove_duplicates=true)
DGtal::ConvexityHelper::dimension
static const Dimension dimension
Definition: ConvexityHelper.h:171
DGtal::ConvexityHelper::computeDegeneratedLatticePolytope
static LatticePolytope computeDegeneratedLatticePolytope(std::vector< Point > &input_points)
DGtal::ConvexHullIntegralKernel
Aim: a geometric kernel to compute the convex hull of digital points with integer-only arithmetic.
Definition: QuickHullKernels.h:376
DGtal::concepts::CInteger
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:87
DGtal::ConvexityHelper::Integer
TInteger Integer
Definition: ConvexityHelper.h:173
DGtal::int32_t
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
DGtal::ConvexityHelper::Point
Space::Point Point
Definition: ConvexityHelper.h:176
DGtal::ConvexityHelper::LatticeConvexHullKernel
ConvexHullIntegralKernel< dim, Integer, InternalInteger > LatticeConvexHullKernel
Definition: ConvexityHelper.h:184
DGtal::DelaunayRationalKernel
Aim: a geometric kernel to compute the Delaunay triangulation of a range of floating points with inte...
Definition: QuickHullKernels.h:830
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::detail::ConvexityHelperInternalInteger< DGtal::int32_t, false >::Type
DGtal::int64_t Type
Definition: ConvexityHelper.h:95
DGtal::detail::ConvexityHelperInternalInteger< DGtal::int64_t, true >::Type
DGtal::BigInteger Type
Definition: ConvexityHelper.h:106
dim
unsigned int dim(const Vector &z)
Definition: viewDualSurface.cpp:174
DGtal::ConvexCellComplex
Aim: represents a d-dimensional complex in a d-dimensional space with the following properties and re...
Definition: ConvexCellComplex.h:85
DGtal::ConvexityHelper::IndexRange
std::vector< Index > IndexRange
Definition: ConvexityHelper.h:182
DGtal::ConvexityHelper::Index
std::size_t Index
Definition: ConvexityHelper.h:181
DGtal::SpaceND
Definition: SpaceND.h:95
DGtal::ConvexityHelper::Vector
Space::Vector Vector
Definition: ConvexityHelper.h:177
DGtal::ConvexityHelper::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(dim > 1)
DGtal::ConvexityHelper::Space
SpaceND< dim, Integer > Space
Definition: ConvexityHelper.h:175
DGtal::ConvexityHelper::computeFacetAndRidgeVertices
static void computeFacetAndRidgeVertices(const QHull &hull, std::vector< IndexRange > &cell_vertices, std::map< typename QHull::Ridge, Index > &r2f, std::vector< IndexRange > &face_vertices)
DGtal::ConvexityHelper::computeDelaunayCellComplex
static bool computeDelaunayCellComplex(ConvexCellComplex< Point > &cell_complex, const std::vector< Point > &input_points, bool remove_duplicates=true)
DGtal::ConvexHullRationalKernel
Aim: a geometric kernel to compute the convex hull of floating points with integer-only arithmetic....
Definition: QuickHullKernels.h:658
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::ConvexityHelper::RealConvexHullKernel
ConvexHullRationalKernel< dim, Integer, InternalInteger > RealConvexHullKernel
Definition: ConvexityHelper.h:186
DGtal::ConvexityHelper::RationalPolytope
BoundedRationalPolytope< Space > RationalPolytope
Definition: ConvexityHelper.h:192
DGtal::ConvexityHelper::RealDelaunayKernel
DelaunayRationalKernel< dim, Integer, InternalInteger > RealDelaunayKernel
Definition: ConvexityHelper.h:190
DGtal::detail::ConvexityHelperInternalInteger< DGtal::BigInteger, safe >::Type
DGtal::BigInteger Type
Definition: ConvexityHelper.h:133
DGtal::detail::ConvexityHelperInternalInteger
Definition: ConvexityHelper.h:70
DGtal::ConvexityHelper::LatticePolytope
BoundedLatticePolytope< Space > LatticePolytope
Definition: ConvexityHelper.h:191
DGtal::ConvexityHelper::computeLatticePolytope
static LatticePolytope computeLatticePolytope(const std::vector< Point > &input_points, bool remove_duplicates=true, bool make_minkowski_summable=false)
DGtal::ConvexityHelper::computeConvexHullBoundary
static bool computeConvexHullBoundary(TSurfaceMesh &mesh, const std::vector< Point > &input_points, bool remove_duplicates=true)
DGtal::ConvexityHelper::computeSimplex
static LatticePolytope computeSimplex(const std::vector< Point > &input_points, bool remove_duplicates=true)
DGtal::ConvexityHelper::LatticeDelaunayKernel
DelaunayIntegralKernel< dim, Integer, InternalInteger > LatticeDelaunayKernel
Definition: ConvexityHelper.h:188
DGtal::BoundedRationalPolytope
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
Definition: BoundedRationalPolytope.h:74
DGtal::detail::ConvexityHelperInternalInteger< DGtal::int32_t, true >::Type
DGtal::BigInteger Type
Definition: ConvexityHelper.h:82
DGtal::ConvexityHelper::Size
std::size_t Size
Definition: ConvexityHelper.h:180
DGtal::PointVector< dim, Integer >
DGtal::detail::ConvexityHelperInternalInteger< DGtal::int64_t, false >::Type
DGtal::int64_t Type
Definition: ConvexityHelper.h:119
DGtal::ConvexityHelper::InternalInteger
TInternalInteger InternalInteger
Definition: ConvexityHelper.h:174
DGtal::BoundedLatticePolytope
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
Definition: BoundedLatticePolytope.h:74
DGtal::int64_t
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
DGtal::ConvexityHelper
Aim: Provides a set of functions to facilitate the computation of convex hulls and polytopes,...
Definition: ConvexityHelper.h:164
DGtal::ConvexityHelper::computeRationalPolytope
static RationalPolytope computeRationalPolytope(const std::vector< RealPoint > &input_points, Integer denominator, bool remove_duplicates=true, bool make_minkowski_summable=false)
DGtal::ConvexityHelper::RealVector
Space::RealVector RealVector
Definition: ConvexityHelper.h:179
DGtal::detail::ConvexityHelperInternalInteger::Type
TIntegerCoordinate Type
Definition: ConvexityHelper.h:71
DGtal::PolygonalSurface
Aim: Represents a polygon mesh, i.e. a 2-dimensional combinatorial surface whose faces are (topologic...
Definition: PolygonalSurface.h:86
DGtal::ConvexityHelper::RealPoint
Space::RealPoint RealPoint
Definition: ConvexityHelper.h:178
DGtal::ConvexityHelper::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))