DGtal  1.5.beta
DGtal::detail::RecursivePConvexity< 1, TInteger > Struct Template Reference

#include <DGtal/geometry/volumes/PConvexity.h>

Public Types

using Integer = TInteger
 
using Point = PointVector< 1, Integer >
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< TInteger >))
 Integer must be a model of the concept CInteger. More...
 
 RecursivePConvexity (Dimension)
 Default constructor. Nothing to do. More...
 

Static Public Member Functions

static bool is0Convex (std::vector< Point > X, bool safe)
 
static bool isPConvex (const std::vector< Point > &X, bool safe)
 
static double convexityMeasure (std::vector< Point > X, bool safe)
 
static double fullConvexityMeasure (const std::vector< Point > &X, bool safe)
 

Detailed Description

template<typename TInteger>
struct DGtal::detail::RecursivePConvexity< 1, TInteger >

Hidden class to represent the P-convexity in a recursive way. Only used to compute P-convexity, but not exposed to users. Specialization for dimension 1

Note
This d-dimensional object builds d (d-1)-dimensional similar objects, but the k-th remembers to build only k lower dimensional ones.
Template Parameters
dimthe dimension of the digital space
TIntegerany model of integer (used to represent digital point coordinates).

Definition at line 251 of file PConvexity.h.

Member Typedef Documentation

◆ Integer

template<typename TInteger >
using DGtal::detail::RecursivePConvexity< 1, TInteger >::Integer = TInteger

Definition at line 254 of file PConvexity.h.

◆ Point

template<typename TInteger >
using DGtal::detail::RecursivePConvexity< 1, TInteger >::Point = PointVector< 1, Integer >

Definition at line 255 of file PConvexity.h.

Constructor & Destructor Documentation

◆ RecursivePConvexity()

template<typename TInteger >
DGtal::detail::RecursivePConvexity< 1, TInteger >::RecursivePConvexity ( Dimension  )
inline

Default constructor. Nothing to do.

Definition at line 258 of file PConvexity.h.

259  {}

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TInteger >
DGtal::detail::RecursivePConvexity< 1, TInteger >::BOOST_CONCEPT_ASSERT ( (concepts::CInteger< TInteger >)  )

Integer must be a model of the concept CInteger.

◆ convexityMeasure()

template<typename TInteger >
static double DGtal::detail::RecursivePConvexity< 1, TInteger >::convexityMeasure ( std::vector< Point X,
bool  safe 
)
inlinestatic
Parameters
Xany range of lattice points (without duplicates)
safeis a not used parameter for dimension 1, but is kept for the meta-programming recursive definition of P-convexity.
Precondition
X must not contain any duplicates.
Returns
a measure that has value 1.0 when X is digitally convex, and less otherwise.

Definition at line 307 of file PConvexity.h.

308  {
309  (void) safe; //< not used in dimension 1.
310  if ( X.empty() ) return 1.0;
311  std::sort( X.begin(), X.end() );
312  Integer nb = Integer(X.back()[ 0 ]) - Integer(X.front()[ 0 ]) + Integer(1);
313  return double( X.size() ) / double( nb );
314  }

◆ fullConvexityMeasure()

template<typename TInteger >
static double DGtal::detail::RecursivePConvexity< 1, TInteger >::fullConvexityMeasure ( const std::vector< Point > &  X,
bool  safe 
)
inlinestatic
Parameters
Xany range of lattice points (without duplicates)
safeis a not used parameter for dimension 1, but is kept for the meta-programming recursive definition of P-convexity.
Precondition
X must not contain any duplicates.
Returns
a measure that has value 1.0 when X is P-convex (or equivalently fully convex), and less otherwise.

Definition at line 327 of file PConvexity.h.

328  {
329  return convexityMeasure( X, safe );
330  }
static double convexityMeasure(std::vector< Point > X, bool safe)
Definition: PConvexity.h:307

References DGtal::detail::RecursivePConvexity< dim, TInteger >::convexityMeasure().

◆ is0Convex()

template<typename TInteger >
static bool DGtal::detail::RecursivePConvexity< 1, TInteger >::is0Convex ( std::vector< Point X,
bool  safe 
)
inlinestatic
Parameters
Xany range of lattice points (without duplicates)
safeis a not used parameter for dimension 1, but is kept for the meta-programming recursive definition of P-convexity.
Returns
'true' if and only if X is a digital set in the classic sense, i.e. \( Conv(X) \cap Z^d = X \).
Note
Unused second parameter.

Definition at line 272 of file PConvexity.h.

273  {
274  (void) safe;
275  std::sort( X.begin(), X.end() );
276  return X.empty()
277  || ( ( Integer(X.back()[ 0 ]) - Integer(X.front()[ 0 ]) + Integer(1) )
278  == Integer( X.size() ) );
279  }

◆ isPConvex()

template<typename TInteger >
static bool DGtal::detail::RecursivePConvexity< 1, TInteger >::isPConvex ( const std::vector< Point > &  X,
bool  safe 
)
inlinestatic
Parameters
Xany range of lattice points (without duplicates)
safeis a not used parameter for dimension 1, but is kept for the meta-programming recursive definition of P-convexity.
Returns
'true' if and only if X is a P-convex digital set.
Precondition
X must not contain any duplicates.

Definition at line 291 of file PConvexity.h.

292  {
293  return is0Convex( X, safe );
294  }
static bool is0Convex(std::vector< Point > X, bool safe)
Definition: PConvexity.h:272

References DGtal::detail::RecursivePConvexity< dim, TInteger >::is0Convex().


The documentation for this struct was generated from the following file: