DGtal  1.5.beta
DGtal::PConvexity< TSpace > Class Template Reference

Aim: A class to check if digital sets are P-convex. The P-convexity is defined as follows: A digital set X subset of \( \mathbb{Z}^d \) is P-convex iff. More...

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

Public Types

typedef PConvexity< TSpace > Self
 
typedef TSpace Space
 
typedef Space::Integer Integer
 
typedef Space::Point Point
 
using RPConvexity = DGtal::detail::RecursivePConvexity< dimension, Integer >
 

Public Member Functions

Standard services (construction, initialization, assignment)
 ~PConvexity ()=default
 Destructor. More...
 
 PConvexity (bool safe=false)
 
Convexity services
bool is0Convex (const std::vector< Point > &X) const
 
bool isPConvex (const std::vector< Point > &X) const
 
Measure services
double convexityMeasure (const std::vector< Point > &X) const
 
double fullConvexityMeasure (const std::vector< Point > &X) const
 
Interface services
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Attributes

static const Dimension dimension = Space::dimension
 

Protected Attributes

RPConvexity myRPC
 The recursive PConvexity object used to determine P-convexity. More...
 
bool mySafe
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 

Detailed Description

template<typename TSpace>
class DGtal::PConvexity< TSpace >

Aim: A class to check if digital sets are P-convex. The P-convexity is defined as follows: A digital set X subset of \( \mathbb{Z}^d \) is P-convex iff.

Description of template class 'PConvexity'

- if d=1, then X must be an interval of integers, possibly empty

  • otherwise X must be 0-convex (digitally convex) and the projection of X along any dimension must be P-convex too.

It is a model of boost::CopyConstructible, boost::DefaultConstructible, boost::Assignable.

Template Parameters
TSpacean arbitrary model of digital space, i.e. see CSpace.

Definition at line 354 of file PConvexity.h.

Member Typedef Documentation

◆ Integer

template<typename TSpace >
typedef Space::Integer DGtal::PConvexity< TSpace >::Integer

Definition at line 361 of file PConvexity.h.

◆ Point

template<typename TSpace >
typedef Space::Point DGtal::PConvexity< TSpace >::Point

Definition at line 362 of file PConvexity.h.

◆ RPConvexity

template<typename TSpace >
using DGtal::PConvexity< TSpace >::RPConvexity = DGtal::detail::RecursivePConvexity< dimension, Integer >

Definition at line 365 of file PConvexity.h.

◆ Self

template<typename TSpace >
typedef PConvexity<TSpace> DGtal::PConvexity< TSpace >::Self

Definition at line 359 of file PConvexity.h.

◆ Space

template<typename TSpace >
typedef TSpace DGtal::PConvexity< TSpace >::Space

Definition at line 360 of file PConvexity.h.

Constructor & Destructor Documentation

◆ ~PConvexity()

template<typename TSpace >
DGtal::PConvexity< TSpace >::~PConvexity ( )
default

Destructor.

◆ PConvexity()

template<typename TSpace >
DGtal::PConvexity< TSpace >::PConvexity ( bool  safe = false)
inline

Main constructor.

Parameters
safewhen 'true' performs convex hull computations with arbitrary precision integer (if available), otherwise chooses a compromise between speed and precision (int64_t).

Definition at line 380 of file PConvexity.h.

381  : myRPC(), mySafe( safe )
382  {}
RPConvexity myRPC
The recursive PConvexity object used to determine P-convexity.
Definition: PConvexity.h:475

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TSpace >
DGtal::PConvexity< TSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )
private

◆ convexityMeasure()

template<typename TSpace >
double DGtal::PConvexity< TSpace >::convexityMeasure ( const std::vector< Point > &  X) const
inline
Parameters
Xany range of lattice points (without duplicates)
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 425 of file PConvexity.h.

426  {
427  return myRPC.convexityMeasure( X, mySafe );
428  }
static double convexityMeasure(const std::vector< Point > &X, bool safe)
Definition: PConvexity.h:155

References DGtal::detail::RecursivePConvexity< dim, TInteger >::convexityMeasure(), DGtal::PConvexity< TSpace >::myRPC, and DGtal::PConvexity< TSpace >::mySafe.

◆ fullConvexityMeasure()

template<typename TSpace >
double DGtal::PConvexity< TSpace >::fullConvexityMeasure ( const std::vector< Point > &  X) const
inline
Parameters
Xany range of lattice points (without duplicates)
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 436 of file PConvexity.h.

437  {
438  return myRPC.fullConvexityMeasure( X, mySafe );
439  }
double fullConvexityMeasure(const std::vector< Point > &X, bool safe) const
Definition: PConvexity.h:189

References DGtal::detail::RecursivePConvexity< dim, TInteger >::fullConvexityMeasure(), DGtal::PConvexity< TSpace >::myRPC, and DGtal::PConvexity< TSpace >::mySafe.

◆ is0Convex()

template<typename TSpace >
bool DGtal::PConvexity< TSpace >::is0Convex ( const std::vector< Point > &  X) const
inline
Parameters
Xany range of lattice points (without duplicates)
Returns
'true' if and only if X is a digitally convex set in the classic sense, i.e. \( Conv(X) \cap Z^d = X \).
Precondition
X must not contain any duplicates.

Definition at line 397 of file PConvexity.h.

398  {
399  return myRPC.is0Convex( X, mySafe );
400  }
static bool is0Convex(const std::vector< Point > &X, bool safe)
Definition: PConvexity.h:100

References DGtal::detail::RecursivePConvexity< dim, TInteger >::is0Convex(), DGtal::PConvexity< TSpace >::myRPC, and DGtal::PConvexity< TSpace >::mySafe.

◆ isPConvex()

template<typename TSpace >
bool DGtal::PConvexity< TSpace >::isPConvex ( const std::vector< Point > &  X) const
inline
Parameters
Xany range of lattice points (without duplicates)
Returns
'true' if and only if X is a P-convex digital set.
Precondition
X must not contain any duplicates.

Definition at line 407 of file PConvexity.h.

408  {
409  return myRPC.isPConvex( X, mySafe );
410  }
bool isPConvex(const std::vector< Point > &X, bool safe) const
Definition: PConvexity.h:133

References DGtal::detail::RecursivePConvexity< dim, TInteger >::isPConvex(), DGtal::PConvexity< TSpace >::myRPC, and DGtal::PConvexity< TSpace >::mySafe.

Referenced by SCENARIO(), timingsPConvexity(), and timingsPConvexityNonConvex().

◆ isValid()

template<typename TSpace >
bool DGtal::PConvexity< TSpace >::isValid ( ) const
inline

Checks the validity/consistency of the object. Only invalid if dimension < 1.

Returns
'true' if the object is valid, 'false' otherwise.

Definition at line 464 of file PConvexity.h.

465  {
466  return dimension >= 1;
467  }
static const Dimension dimension
Definition: PConvexity.h:364

References DGtal::PConvexity< TSpace >::dimension.

◆ selfDisplay()

template<typename TSpace >
void DGtal::PConvexity< TSpace >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Definition at line 452 of file PConvexity.h.

453  {
454  out << "[PConvexity dim=" << dimension
455  << " safe=" << ( mySafe ? "True" : "False" )
456  << " #bits<int>=" << ( sizeof( Integer ) * 8 ) << "]";
457  }

References DGtal::PConvexity< TSpace >::dimension, and DGtal::PConvexity< TSpace >::mySafe.

Field Documentation

◆ dimension

template<typename TSpace >
const Dimension DGtal::PConvexity< TSpace >::dimension = Space::dimension
static

◆ myRPC

template<typename TSpace >
RPConvexity DGtal::PConvexity< TSpace >::myRPC
protected

◆ mySafe

template<typename TSpace >
bool DGtal::PConvexity< TSpace >::mySafe
protected

when 'true' performs convex hull computations with arbitrary precision integer (if available), otherwise chooses a compromise between speed and precision (int64_t).

Definition at line 480 of file PConvexity.h.

Referenced by DGtal::PConvexity< TSpace >::convexityMeasure(), DGtal::PConvexity< TSpace >::fullConvexityMeasure(), DGtal::PConvexity< TSpace >::is0Convex(), DGtal::PConvexity< TSpace >::isPConvex(), and DGtal::PConvexity< TSpace >::selfDisplay().


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