Processing math: 100%
DGtal 2.0.0
DGtal::detail::RecursivePConvexity< 1, TInteger > Struct Template Reference

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

Inheritance diagram for DGtal::detail::RecursivePConvexity< 1, TInteger >:
[legend]

Public Types

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

Public Member Functions

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

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)
static ProjPoint project (const Point &p, Dimension a)

Data Fields

std::vector< ProjPConvexityprojp
 The array of lower dimensional P-convexities.

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.

◆ ProjPConvexity

using DGtal::detail::RecursivePConvexity< dim, TInteger >::ProjPConvexity

Definition at line 72 of file PConvexity.h.

◆ ProjPoint

using DGtal::detail::RecursivePConvexity< dim, TInteger >::ProjPoint

Definition at line 71 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>
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>
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().

◆ init()

void DGtal::detail::RecursivePConvexity< dim, TInteger >::init ( Dimension bd = dim)
inline
Parameters
bdthe maximum axis of projection.

Definition at line 83 of file PConvexity.h.

84 {
85 for ( Dimension j = 0; j < bd; j++ )
86 projp.push_back( ProjPConvexity( j ) );
87 }
DGtal::detail::RecursivePConvexity< dim - 1, Integer > ProjPConvexity
Definition PConvexity.h:72

◆ is0Convex()

template<typename TInteger>
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>
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().

◆ project()

ProjPoint DGtal::detail::RecursivePConvexity< dim, TInteger >::project ( const Point & p,
Dimension a )
inlinestatic

Projects a point p along dimension a.

Parameters
[in]pany digital point
[in]aany dimension
Returns
the digital point of dimension (d-1) with omitted a-th coordinate.

Definition at line 206 of file PConvexity.h.

207 {
209 Dimension j = 0;
210 for ( Dimension i = 0; i < Point::dimension; i++ )
211 if ( i != a ) pp[ j++ ] = p[ i ];
212 return pp;
213 }
static const Dimension dimension
DGtal::PointVector< dim-1, Integer > ProjPoint
Definition PConvexity.h:71

Field Documentation

◆ projp

std::vector< ProjPConvexity > DGtal::detail::RecursivePConvexity< dim, TInteger >::projp

The array of lower dimensional P-convexities.

Definition at line 237 of file PConvexity.h.


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