DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Static Public Attributes | Protected Attributes | Private Member Functions | Static Private Member Functions
DGtal::DigitalConvexity< TKSpace > Class Template Reference

Aim: A helper class to build polytopes from digital sets and to check digital k-convexity and full convexity. More...

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

Public Types

typedef DigitalConvexity< TKSpace > Self
 
typedef TKSpace KSpace
 
typedef KSpace::Integer Integer
 
typedef KSpace::Point Point
 
typedef KSpace::Vector Vector
 
typedef KSpace::Cell Cell
 
typedef KSpace::Space Space
 
typedef std::size_t Size
 
typedef DGtal::BoundedLatticePolytope< SpacePolytope
 
typedef DGtal::BoundedLatticePolytope< SpaceLatticePolytope
 
typedef DGtal::BoundedRationalPolytope< SpaceRationalPolytope
 
typedef DGtal::CellGeometry< KSpaceCellGeometry
 
typedef std::vector< PointPointRange
 
typedef std::unordered_set< PointPointSet
 
typedef DGtal::BoundedLatticePolytopeCounter< SpaceCounter
 
typedef Counter::Interval Interval
 
typedef DGtal::LatticeSetByIntervals< SpaceLatticeSet
 

Public Member Functions

Standard services (construction, initialization, assignment)
 ~DigitalConvexity ()=default
 
 DigitalConvexity ()=default
 
 DigitalConvexity (const Self &other)=default
 
 DigitalConvexity (Clone< KSpace > K, bool safe=false)
 
 DigitalConvexity (Point lo, Point hi, bool safe=false)
 
Selfoperator= (const Self &other)=default
 
const KSpacespace () const
 
Cell geometry services
template<typename PointIterator >
CellGeometry makeCellCover (PointIterator itB, PointIterator itE, Dimension i=0, Dimension k=KSpace::dimension) const
 
CellGeometry makeCellCover (const LatticePolytope &P, Dimension i=0, Dimension k=KSpace::dimension) const
 
CellGeometry makeCellCover (const RationalPolytope &P, Dimension i=0, Dimension k=KSpace::dimension) const
 
Morphological services
LatticePolytope makePolytope (const PointRange &X, bool make_minkowski_summable=false) const
 
PointRange U (Dimension i, const PointRange &X) const
 
bool is0Convex (const PointRange &X) const
 
bool isFullyConvex (const PointRange &X, bool convex0=false) const
 
bool isFullyConvexFast (const PointRange &X) const
 
bool isFullySubconvex (const PointRange &Y, const LatticeSet &StarX) const
 
bool isKSubconvex (const Point &a, const Point &b, const CellGeometry &C, const Dimension k) const
 
bool isFullySubconvex (const Point &a, const Point &b, const CellGeometry &C) const
 
bool isFullySubconvex (const Point &a, const Point &b, const LatticeSet &StarX) const
 
LatticePolytope CvxH (const PointRange &X) const
 
PointRange ExtrCvxH (const PointRange &X) const
 
LatticeSet StarCvxH (const PointRange &X, Dimension axis=dimension) const
 
Integer sizeStarCvxH (const PointRange &X) const
 
LatticeSet Star (const PointRange &X, Dimension axis=dimension) const
 
LatticeSet StarCells (const PointRange &C, Dimension axis=dimension) const
 
PointRange Extr (const PointRange &C) const
 
PointRange Extr (const LatticeSet &C) const
 
LatticeSet Skel (const LatticeSet &C) const
 
PointRange ExtrSkel (const LatticeSet &C) const
 
LatticeSet toLatticeSet (const PointRange &X, Dimension axis=dimension) const
 
PointRange toPointRange (const LatticeSet &L) const
 
Convexity services for lattice polytopes
bool isKConvex (const LatticePolytope &P, const Dimension k) const
 
bool isFullyConvex (const LatticePolytope &P) const
 
bool isKSubconvex (const LatticePolytope &P, const CellGeometry &C, const Dimension k) const
 
bool isFullySubconvex (const LatticePolytope &P, const CellGeometry &C) const
 
bool isFullySubconvex (const LatticePolytope &P, const LatticeSet &StarX) const
 
Convexity services for rational polytopes
bool isKConvex (const RationalPolytope &P, const Dimension k) const
 
bool isFullyConvex (const RationalPolytope &P) const
 
bool isKSubconvex (const RationalPolytope &P, const CellGeometry &C, const Dimension k) const
 
bool isFullySubconvex (const RationalPolytope &P, const CellGeometry &C) const
 
Interface services
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 

Static Public Member Functions

Lattice and rational polytope services
static PointRange insidePoints (const LatticePolytope &polytope)
 
static PointRange interiorPoints (const LatticePolytope &polytope)
 
static PointRange insidePoints (const RationalPolytope &polytope)
 
static PointRange interiorPoints (const RationalPolytope &polytope)
 

Static Public Attributes

static const Dimension dimension = KSpace::dimension
 

Protected Attributes

KSpace myK
 The cellular grid space where computations are done. More...
 
bool mySafe
 
Size myDepthLastFCE
 The number of iterations of the last FullyConvexEnvelope operation. More...
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CCellularGridSpaceND< TKSpace >))
 
PointRange FC_direct (const PointRange &Z) const
 
PointRange FC_LatticeSet (const PointRange &Z) const
 

Static Private Member Functions

static void eraseInterval (Interval I, std::vector< Interval > &V)
 
template<typename Predicate >
static PointRange filter (const PointRange &E, const Predicate &Pred)
 

Simplex services

enum class  SimplexType { INVALID , DEGENERATED , UNITARY , COMMON }
 The possible types for simplices. More...
 
template<typename PointIterator >
static LatticePolytope makeSimplex (PointIterator itB, PointIterator itE)
 
static LatticePolytope makeSimplex (std::initializer_list< Point > l)
 
template<typename PointIterator >
static RationalPolytope makeRationalSimplex (Integer d, PointIterator itB, PointIterator itE)
 
static RationalPolytope makeRationalSimplex (std::initializer_list< Point > l)
 
template<typename PointIterator >
static bool isSimplexFullDimensional (PointIterator itB, PointIterator itE)
 
static bool isSimplexFullDimensional (std::initializer_list< Point > l)
 
template<typename PointIterator >
static SimplexType simplexType (PointIterator itB, PointIterator itE)
 
static SimplexType simplexType (std::initializer_list< Point > l)
 
template<typename PointIterator >
static void displaySimplex (std::ostream &out, PointIterator itB, PointIterator itE)
 
static void displaySimplex (std::ostream &out, std::initializer_list< Point > l)
 

Convex envelope services

enum class  EnvelopeAlgorithm { DIRECT , LATTICE_SET }
 
PointRange FC (const PointRange &Z, EnvelopeAlgorithm algo=EnvelopeAlgorithm::DIRECT) const
 
PointRange envelope (const PointRange &Z, EnvelopeAlgorithm algo=EnvelopeAlgorithm::DIRECT) const
 
PointRange relativeEnvelope (const PointRange &Z, const PointRange &Y, EnvelopeAlgorithm algo=EnvelopeAlgorithm::DIRECT) const
 
template<typename Predicate >
PointRange relativeEnvelope (const PointRange &Z, const Predicate &PredY, EnvelopeAlgorithm algo=EnvelopeAlgorithm::DIRECT) const
 
Size depthLastEnvelope () const
 

Detailed Description

template<typename TKSpace>
class DGtal::DigitalConvexity< TKSpace >

Aim: A helper class to build polytopes from digital sets and to check digital k-convexity and full convexity.

Description of template class 'DigitalConvexity'

See also
moduleDigitalConvexity

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

Template Parameters
TKSpacean arbitrary model of CCellularGridSpaceND.
Examples
geometry/curves/exampleDigitalConvexity.cpp, geometry/curves/exampleRationalConvexity.cpp, geometry/volumes/checkFullConvexityTheorems.cpp, geometry/volumes/digitalPolyhedronBuilder3D.cpp, and geometry/volumes/standardDigitalPolyhedronBuilder3D.cpp.

Definition at line 77 of file DigitalConvexity.h.

Member Typedef Documentation

◆ Cell

template<typename TKSpace >
typedef KSpace::Cell DGtal::DigitalConvexity< TKSpace >::Cell

Definition at line 87 of file DigitalConvexity.h.

◆ CellGeometry

template<typename TKSpace >
typedef DGtal::CellGeometry< KSpace > DGtal::DigitalConvexity< TKSpace >::CellGeometry

Definition at line 93 of file DigitalConvexity.h.

◆ Counter

template<typename TKSpace >
typedef DGtal::BoundedLatticePolytopeCounter< Space > DGtal::DigitalConvexity< TKSpace >::Counter

Definition at line 96 of file DigitalConvexity.h.

◆ Integer

template<typename TKSpace >
typedef KSpace::Integer DGtal::DigitalConvexity< TKSpace >::Integer

Definition at line 84 of file DigitalConvexity.h.

◆ Interval

template<typename TKSpace >
typedef Counter::Interval DGtal::DigitalConvexity< TKSpace >::Interval

Definition at line 97 of file DigitalConvexity.h.

◆ KSpace

template<typename TKSpace >
typedef TKSpace DGtal::DigitalConvexity< TKSpace >::KSpace

Definition at line 83 of file DigitalConvexity.h.

◆ LatticePolytope

template<typename TKSpace >
typedef DGtal::BoundedLatticePolytope< Space > DGtal::DigitalConvexity< TKSpace >::LatticePolytope

Definition at line 91 of file DigitalConvexity.h.

◆ LatticeSet

template<typename TKSpace >
typedef DGtal::LatticeSetByIntervals< Space > DGtal::DigitalConvexity< TKSpace >::LatticeSet

Definition at line 98 of file DigitalConvexity.h.

◆ Point

template<typename TKSpace >
typedef KSpace::Point DGtal::DigitalConvexity< TKSpace >::Point

Definition at line 85 of file DigitalConvexity.h.

◆ PointRange

template<typename TKSpace >
typedef std::vector<Point> DGtal::DigitalConvexity< TKSpace >::PointRange

Definition at line 94 of file DigitalConvexity.h.

◆ PointSet

template<typename TKSpace >
typedef std::unordered_set<Point> DGtal::DigitalConvexity< TKSpace >::PointSet

Definition at line 95 of file DigitalConvexity.h.

◆ Polytope

template<typename TKSpace >
typedef DGtal::BoundedLatticePolytope< Space > DGtal::DigitalConvexity< TKSpace >::Polytope

Definition at line 90 of file DigitalConvexity.h.

◆ RationalPolytope

template<typename TKSpace >
typedef DGtal::BoundedRationalPolytope< Space > DGtal::DigitalConvexity< TKSpace >::RationalPolytope

Definition at line 92 of file DigitalConvexity.h.

◆ Self

template<typename TKSpace >
typedef DigitalConvexity<TKSpace> DGtal::DigitalConvexity< TKSpace >::Self

Definition at line 82 of file DigitalConvexity.h.

◆ Size

template<typename TKSpace >
typedef std::size_t DGtal::DigitalConvexity< TKSpace >::Size

Definition at line 89 of file DigitalConvexity.h.

◆ Space

template<typename TKSpace >
typedef KSpace::Space DGtal::DigitalConvexity< TKSpace >::Space

Definition at line 88 of file DigitalConvexity.h.

◆ Vector

template<typename TKSpace >
typedef KSpace::Vector DGtal::DigitalConvexity< TKSpace >::Vector

Definition at line 86 of file DigitalConvexity.h.

Member Enumeration Documentation

◆ EnvelopeAlgorithm

template<typename TKSpace >
enum class DGtal::DigitalConvexity::EnvelopeAlgorithm
strong

Choice of algorithm for computing the fully convex envelope of a digital set.

Enumerator
DIRECT 

Slightly faster but quite ugly big function

LATTICE_SET 

Slightly slower function but decomposes well the algorithm

Definition at line 642 of file DigitalConvexity.h.

◆ SimplexType

template<typename TKSpace >
enum class DGtal::DigitalConvexity::SimplexType
strong

The possible types for simplices.

Enumerator
INVALID 

When there are not the right number of vertices.

DEGENERATED 

When the points of the simplex are not in general position.

UNITARY 

When its edges form a unit parallelotope (det = +/- 1)

COMMON 

Common simplex.

Definition at line 237 of file DigitalConvexity.h.

237 {
238 INVALID,
240 UNITARY,
241 COMMON
242 };
@ UNITARY
When its edges form a unit parallelotope (det = +/- 1)
@ INVALID
When there are not the right number of vertices.
@ DEGENERATED
When the points of the simplex are not in general position.

Constructor & Destructor Documentation

◆ ~DigitalConvexity()

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::~DigitalConvexity ( )
default

Destructor.

◆ DigitalConvexity() [1/4]

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::DigitalConvexity ( )
default

Constructor.

◆ DigitalConvexity() [2/4]

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::DigitalConvexity ( const Self other)
default

Copy constructor.

Parameters
otherthe object to clone.

◆ DigitalConvexity() [3/4]

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::DigitalConvexity ( Clone< KSpace K,
bool  safe = false 
)

Constructor from cellular space.

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

◆ DigitalConvexity() [4/4]

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::DigitalConvexity ( Point  lo,
Point  hi,
bool  safe = false 
)

Constructor from lower and upper points.

Parameters
lothe lowest point of the domain (bounding box for computations).
hithe highest point of the domain (bounding box for computations).
safewhen 'true' performs convex hull computations with arbitrary precision integer (if available), otherwise chooses a compromise between speed and precision (int64_t).

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TKSpace >
DGtal::DigitalConvexity< TKSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CCellularGridSpaceND< TKSpace >)  )
private

◆ CvxH()

template<typename TKSpace >
LatticePolytope DGtal::DigitalConvexity< TKSpace >::CvxH ( const PointRange X) const
inline

Given a range of distinct points X, computes the tightiest polytope that enclosed it. Note that this polytope may contain more lattice points than the given input points.

Parameters
Xany range of pairwise distinct points
Returns
the corresponding lattice polytope.
Note
alias for DigitalConvexity::makePolytope

Definition at line 504 of file DigitalConvexity.h.

505 {
506 return makePolytope( X );
507 }
LatticePolytope makePolytope(const PointRange &X, bool make_minkowski_summable=false) const

References DGtal::DigitalConvexity< TKSpace >::makePolytope().

◆ depthLastEnvelope()

template<typename TKSpace >
Size DGtal::DigitalConvexity< TKSpace >::depthLastEnvelope ( ) const
Returns
the number of iterations of the last process FC^*(Z):=FC(FC(....FC(Z)...)), i.e. the last call to DigitalConvexity::envelope or DigitalConvexity::relativeEnvelope .

Referenced by SCENARIO().

◆ displaySimplex() [1/2]

template<typename TKSpace >
template<typename PointIterator >
static void DGtal::DigitalConvexity< TKSpace >::displaySimplex ( std::ostream &  out,
PointIterator  itB,
PointIterator  itE 
)
static

Displays information about the simplex formed by the given range [itB,itE) of lattice points.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
[in,out]outthe output stream where information is outputed.
itBthe start of the range of n+1 points defining the simplex.
itEpast the end the range of n+1 points defining the simplex.

◆ displaySimplex() [2/2]

template<typename TKSpace >
static void DGtal::DigitalConvexity< TKSpace >::displaySimplex ( std::ostream &  out,
std::initializer_list< Point l 
)
static

Displays information about simplex formed by the given list l of lattice points.

Parameters
[in,out]outthe output stream where information is outputed.
lany list of lattice points.

◆ envelope()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::envelope ( const PointRange Z,
EnvelopeAlgorithm  algo = EnvelopeAlgorithm::DIRECT 
) const

Computes the fully convex envelope of Z, i.e. \( FC^*(Z):=FC(FC( \ldots FC(Z) \ldots )) \), for Z a range of points, until stabilization of the iterative process.

Parameters
Zany range of points (must be sorted).
algothe chosen method of computation.
Returns
\( FC^*( Z ) \)
Note
If Z is fully convex, then the output is Z itself. Otherwise, the returned set of points includes Z and is fully convex.

Referenced by checkCvxHPlusHypercubeFullConvexity(), checkProjectionFullConvexity(), checkSkelStarCvxHFullConvexity(), main(), and SCENARIO().

◆ eraseInterval()

template<typename TKSpace >
static void DGtal::DigitalConvexity< TKSpace >::eraseInterval ( Interval  I,
std::vector< Interval > &  V 
)
staticprivate

Erase the interval I from the intervals in V such that the integer in I are not part of V anymore.

Parameters
[in]Iis a closed interval
[in,out]Vis a sorted list of closed intervals

◆ Extr() [1/2]

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::Extr ( const LatticeSet C) const
Parameters
Ca range of cells represented as a lattice set.
Returns
the range of digital points that are the extremal vertices to the cells in C.

◆ Extr() [2/2]

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::Extr ( const PointRange C) const
Parameters
Ca range of cells represented with points in Khalimsky coordinates.
Returns
the range of digital points that are the extremal vertices to the cells in C.

◆ ExtrCvxH()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::ExtrCvxH ( const PointRange X) const

Given a range of distinct points X, computes the vertices of the tightiest polytope that enclosed it.

Parameters
Xany range of pairwise distinct points
Returns
the vertices or extrema of CvxH(X).
Note
The method works in nD for full dimensional convex hulls. It can handle not full dimensional convex hull up to dimension 3 included.

◆ ExtrSkel()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::ExtrSkel ( const LatticeSet C) const
Parameters
Ca range of cells represented as a lattice set.
Returns
the range of digital points that are the extremal vertices to the skeleton of the cells in C.

◆ FC()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::FC ( const PointRange Z,
EnvelopeAlgorithm  algo = EnvelopeAlgorithm::DIRECT 
) const

Computes FC(Z):=Extr(Skel(Star(CvxH(Z)))), for Z a range of points

Parameters
Zany range of points (must be sorted).
algothe chosen method of computation.
Returns
FC( Z )

◆ FC_direct()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::FC_direct ( const PointRange Z) const
private

Computes FC(Z):=Extr(Skel(Star(CvxH(Z)))), for Z a range of points

Parameters
Zany range of points (must be sorted).
Returns
FC( Z )

◆ FC_LatticeSet()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::FC_LatticeSet ( const PointRange Z) const
private

Computes FC(Z):=Extr(Skel(Star(CvxH(Z)))), for Z a range of points

Parameters
Zany range of points (must be sorted).
Returns
FC( Z )

◆ filter()

template<typename TKSpace >
template<typename Predicate >
static PointRange DGtal::DigitalConvexity< TKSpace >::filter ( const PointRange E,
const Predicate &  Pred 
)
staticprivate

Filters the points of E and outputs only the ones that satisfies the given predicate Pred.

Template Parameters
Predicatethe type of a predicate Point -> boolean
Parameters
[in]Eany range of point
[in]Predthe predicate Point -> boolean
Returns
the subset of E whose elements satisfy the predicate Pred.

◆ insidePoints() [1/2]

template<typename TKSpace >
static PointRange DGtal::DigitalConvexity< TKSpace >::insidePoints ( const LatticePolytope polytope)
static
Parameters
polytopeany lattice polytope.
Returns
the range of digital points that belongs to the polytope.

Referenced by SCENARIO().

◆ insidePoints() [2/2]

template<typename TKSpace >
static PointRange DGtal::DigitalConvexity< TKSpace >::insidePoints ( const RationalPolytope polytope)
static
Parameters
polytopeany rational polytope.
Returns
the range of digital points that belongs to the polytope.

◆ interiorPoints() [1/2]

template<typename TKSpace >
static PointRange DGtal::DigitalConvexity< TKSpace >::interiorPoints ( const LatticePolytope polytope)
static
Parameters
polytopeany lattice polytope.
Returns
the range of digital points that belongs to the interior of the polytope.

◆ interiorPoints() [2/2]

template<typename TKSpace >
static PointRange DGtal::DigitalConvexity< TKSpace >::interiorPoints ( const RationalPolytope polytope)
static
Parameters
polytopeany rational polytope.
Returns
the range of digital points that belongs to the interior of the polytope.

◆ is0Convex()

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::is0Convex ( const PointRange X) const

Tells if a given point range X is digitally 0-convex, i.e. \( \mathrm{Cvxh}(X) \cap \mathbb{Z}^d = X \). It works for arbitrary set of points in arbitrary dimenion.

Parameters
Xany range of pairwise distinct points
Returns
'true' iff X is fully digitally convex.

Referenced by checkFullConvexityCharacterization(), DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::is0Convex(), DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::isComplementary0Convex(), and SCENARIO().

◆ isFullyConvex() [1/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullyConvex ( const LatticePolytope P) const

Tells if a given polytope P is fully digitally convex. The digital 0-convexity is the usual property \( Conv( P \cap Z^d ) = P \cap Z^d) \). Otherwise the property asks that the points inside P touch as many k-cells that the convex hull of P, for any valid dimension k.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
Returns
'true' iff the polytope P is fully digitally convex.
Note
A polytope is always digitally 0-convex. Furthermore, if it is not digitally d-1-convex then it is digitally d-convex (d := KSpace::dimension). Hence, we only check k-convexity for 1 <= k <= d-1.

◆ isFullyConvex() [2/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullyConvex ( const PointRange X,
bool  convex0 = false 
) const

Tells if a given point range X is fully digitally convex. The test uses the morphological characterization of full convexity. It is slightly slower than testing full convexity on simplices, but it works for arbitrary set of points in arbitrary dimenion.

Parameters
Xany range of pairwise distinct points
convex0when 'true' indicates that X is known to be digitally 0-convex, otherwise the method will check it also.
Returns
'true' iff X is fully digitally convex.

Referenced by checkCvxHPlusHypercubeFullConvexity(), checkFullConvexityCharacterization(), checkSkelStarCvxHFullConvexity(), DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::isComplementaryFullyConvex(), DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::isFullyConvex(), and SCENARIO().

◆ isFullyConvex() [3/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullyConvex ( const RationalPolytope P) const

Tells if a given polytope P is fully digitally convex. The digital 0-convexity is the usual property \( Conv( P \cap Z^d ) = P \cap Z^d) \). Otherwise the property asks that the points inside P touch as many k-cells that the convex hull of P, for any valid dimension k.

Parameters
Pany rational polytope such that P.canBeSummed() == true.
Returns
'true' iff the polytope P is fully digitally convex.
Note
A polytope is always digitally 0-convex. Furthermore, if it is not digitally d-1-convex then it is digitally d-convex (d := KSpace::dimension). Hence, we only check k-convexity for 1 <= k <= d-1.

◆ isFullyConvexFast()

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullyConvexFast ( const PointRange X) const

Tells if a given point range X is fully digitally convex. The test uses the morphological characterization of full convexity and a fast way to compute lattice points within a polytope. It works for arbitrary set of points in arbitrary dimenion.

Parameters
Xany range of pairwise distinct points
Returns
'true' iff X is fully digitally convex.
Note
This method is generally faster than DigitalConvexity::isFullyConvex if (1) the set is indeed is fully convex, (2) the dimension is high (>= 3 or 4).

Referenced by SCENARIO().

◆ isFullySubconvex() [1/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const LatticePolytope P,
const CellGeometry C 
) const

Tells if a given polytope P is digitally fully subconvex to some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of P is a subset of the k-cells of C.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
Cany cell cover geometry (i.e. a cubical complex).
Returns
'true' iff the polytope P is digitally fully subconvex to C.
Note
This method only checks the k-subconvexity for valid dimensions stored in C.

◆ isFullySubconvex() [2/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const LatticePolytope P,
const LatticeSet StarX 
) const

Tells if a given polytope P is digitally fully subconvex to some lattice set Star_X, i.e. the cell cover of some set X represented by lattice points.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
StarXany lattice set representing an open cubical complex.
Returns
'true' iff Y is digitally fully subconvex to X.

◆ isFullySubconvex() [3/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const Point a,
const Point b,
const CellGeometry C 
) const

Tells if a given segment from a to b is digitally fully subconvex (i.e. tangent) to some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of the segment is a subset of the k-cells of C.

Parameters
aany point
bany point
Cany cell cover geometry (i.e. a cubical complex).
Returns
'true' iff the segment is a digitally fully subconvex of C, i.e. the two points are cotangent.
Note
Three times faster than building a (degenerated) lattice polytope and then checking if it subconvex.

◆ isFullySubconvex() [4/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const Point a,
const Point b,
const LatticeSet StarX 
) const

Tells if a given segment from a to b is digitally fully subconvex (i.e. tangent) to some open complex StarX.

Parameters
aany point
bany point
StarXany lattice set representing an open cubical complex.
Returns
'true' iff the segment is a digitally fully subconvex of C, i.e. the two points are cotangent.
Note
Three times faster than building a (degenerated) lattice polytope and then checking if it subconvex.

◆ isFullySubconvex() [5/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const PointRange Y,
const LatticeSet StarX 
) const

Tells if a given set of points Y is digitally fully subconvex to some lattice set Star_X, i.e. the cell cover of some set X represented by lattice points.

Parameters
Yany set of points
StarXany lattice set representing an open cubical complex.
Returns
'true' iff Y is digitally fully subconvex to X.
Note
This method is slower than the two others, since it builds the polytope embracing Y. However it is much more generic since the two other methods require a Minkowski summable polytope, i.e. P.canBeSummed() == true.

Referenced by main(), and SCENARIO().

◆ isFullySubconvex() [6/6]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isFullySubconvex ( const RationalPolytope P,
const CellGeometry C 
) const

Tells if a given polytope P is digitally fully subconvex to some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of P is a subset of the k-cells of C.

Parameters
Pany rational polytope such that P.canBeSummed() == true.
Cany cell cover geometry (i.e. a cubical complex).
Returns
'true' iff the polytope P is digitally fully subconvex to C.
Note
This method only checks the k-subconvexity for valid dimensions stored in C.

◆ isKConvex() [1/2]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isKConvex ( const LatticePolytope P,
const Dimension  k 
) const

Tells if a given polytope P is digitally k-convex. The digital 0-convexity is the usual property \( Conv( P \cap Z^d ) = P \cap Z^d) \). Otherwise the property asks that the points inside P touch as many k-cells that the convex hull of P.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
kthe dimension for which the digital k-convexity is checked, 0 <= k <= KSpace::dimension.
Returns
'true' iff the polytope P is digitally k-convex.
Note
A polytope is always digitally 0-convex. Furthermore, if it is not digitally d-1-convex then it is digitally not d-convex (d := KSpace::dimension).

Referenced by SCENARIO().

◆ isKConvex() [2/2]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isKConvex ( const RationalPolytope P,
const Dimension  k 
) const

Tells if a given polytope P is digitally k-convex. The digital 0-convexity is the usual property \( Conv( P \cap Z^d ) = P \cap Z^d) \). Otherwise the property asks that the points inside P touch as many k-cells that the convex hull of P.

Parameters
Pany rational polytope such that P.canBeSummed() == true.
kthe dimension for which the digital k-convexity is checked, 0 <= k <= KSpace::dimension.
Returns
'true' iff the polytope P is digitally k-convex.
Note
A polytope is always digitally 0-convex. Furthermore, if it is not digitally d-1-convex then it is digitally not d-convex (d := KSpace::dimension).

◆ isKSubconvex() [1/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isKSubconvex ( const LatticePolytope P,
const CellGeometry C,
const Dimension  k 
) const

Tells if a given polytope P is digitally k-subconvex of some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of P is a subset of the k-cells of C.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
Cany cell cover geometry (i.e. a cubical complex).
kthe dimension for which the digital k-convexity is checked, 0 <= k <= KSpace::dimension.
Returns
'true' iff the polytope P is a digitally k-subconvex of C.

◆ isKSubconvex() [2/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isKSubconvex ( const Point a,
const Point b,
const CellGeometry C,
const Dimension  k 
) const

Tells if a given segment from a to b is digitally k-subconvex (i.e. k-tangent) to some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of the segment is a subset of the k-cells of C.

Parameters
aany point
bany point
Cany cell cover geometry (i.e. a cubical complex).
kthe dimension for which the digital k-convexity is checked, 0 <= k <= KSpace::dimension.
Returns
'true' iff the segment is a digitally k-subconvex of C, i.e. the two points are k-cotangent.
Note
Three times faster than building a (degenerated) lattice polytope and then checking if it subconvex.

◆ isKSubconvex() [3/3]

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isKSubconvex ( const RationalPolytope P,
const CellGeometry C,
const Dimension  k 
) const

Tells if a given polytope P is digitally k-subconvex of some cell cover C. The digital 0-subconvexity is the usual property \( Conv( P \cap Z^d ) \subset C \cap Z^d) \). Otherwise the property asks that the k-cells intersected by the convex hull of P is a subset of the k-cells of C.

Parameters
Pany rational polytope such that P.canBeSummed() == true.
Cany cell cover geometry (i.e. a cubical complex).
kthe dimension for which the digital k-convexity is checked, 0 <= k <= KSpace::dimension.
Returns
'true' iff the polytope P is a digitally k-subconvex of C.

◆ isSimplexFullDimensional() [1/2]

template<typename TKSpace >
template<typename PointIterator >
static bool DGtal::DigitalConvexity< TKSpace >::isSimplexFullDimensional ( PointIterator  itB,
PointIterator  itE 
)
static

Checks if the given range [itB,itE) of lattice points form a full dimensional simplex, i.e. it must contain Space::dimension+1 points in general position.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
itBthe start of the range of n+1 points defining the simplex.
itEpast the end the range of n+1 points defining the simplex.

Referenced by main(), and SCENARIO().

◆ isSimplexFullDimensional() [2/2]

template<typename TKSpace >
static bool DGtal::DigitalConvexity< TKSpace >::isSimplexFullDimensional ( std::initializer_list< Point l)
static

Checks if the given list of lattice points l form a full dimensional simplex, i.e. it must contain Space::dimension+1 points in general position.

Parameters
lany list of d+1 points in general positions.

◆ isValid()

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::isValid ( ) const

Checks the validity/consistency of the object. If the polytope has been default constructed, it is invalid.

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

◆ makeCellCover() [1/3]

template<typename TKSpace >
CellGeometry DGtal::DigitalConvexity< TKSpace >::makeCellCover ( const LatticePolytope P,
Dimension  i = 0,
Dimension  k = KSpace::dimension 
) const

Builds the cell geometry containing all the j-cells touching the lattice polytope P, for i <= j <= k. It conbains thus all the j-cells intersecting the convex hull of P.

Parameters
Pany lattice polytope such that P.canBeSummed() == true.
ithe first dimension for which the cell cover is computed.
kthe last dimension for which the cell cover is computed.

◆ makeCellCover() [2/3]

template<typename TKSpace >
CellGeometry DGtal::DigitalConvexity< TKSpace >::makeCellCover ( const RationalPolytope P,
Dimension  i = 0,
Dimension  k = KSpace::dimension 
) const

Builds the cell geometry containing all the j-cells touching the rational polytope P, for i <= j <= k. It conbains thus all the j-cells intersecting the convex hull of P.

Parameters
Pany rational polytope such that P.canBeSummed() == true.
ithe first dimension for which the cell cover is computed.
kthe last dimension for which the cell cover is computed.

◆ makeCellCover() [3/3]

template<typename TKSpace >
template<typename PointIterator >
CellGeometry DGtal::DigitalConvexity< TKSpace >::makeCellCover ( PointIterator  itB,
PointIterator  itE,
Dimension  i = 0,
Dimension  k = KSpace::dimension 
) const

Builds the cell geometry containing all the j-cells touching a point of [itB,itE), for i <= j <= k.

Template Parameters
PointIteratorany model of input iterator on Points.
Parameters
itBstart of a range of arbitrary points.
itEpast the end of a range of arbitrary points.
ithe first dimension for which the cell cover is computed.
kthe last dimension for which the cell cover is computed.

Referenced by main(), and SCENARIO().

◆ makePolytope()

template<typename TKSpace >
LatticePolytope DGtal::DigitalConvexity< TKSpace >::makePolytope ( const PointRange X,
bool  make_minkowski_summable = false 
) const

Given a range of distinct points X, computes the tightiest polytope that enclosed it. Note that this polytope may contain more lattice points than the given input points.

Parameters
Xany range of pairwise distinct points
[in]make_minkowski_summableOther constraints are added so that we can perform axis aligned Minkowski sums on this polytope. Useful in 2D/3D for checking digital k-convexity (see moduleDigitalConvexity).
Returns
the corresponding lattice polytope.

Referenced by checkCvxHPlusHypercubeFullConvexity(), checkFullConvexityCharacterization(), DGtal::DigitalConvexity< TKSpace >::CvxH(), and SCENARIO().

◆ makeRationalSimplex() [1/2]

template<typename TKSpace >
template<typename PointIterator >
static RationalPolytope DGtal::DigitalConvexity< TKSpace >::makeRationalSimplex ( Integer  d,
PointIterator  itB,
PointIterator  itE 
)
static

Constructs a rational polytope from a rational simplex given as a range [itB,itE) of lattice points. Note that the range must contain Space::dimension+1 points or less in general position.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
dthe common denominator of all given lattice point coordinates.
itBthe start of the range of no more than n+1 points defining the simplex.
itEpast the end the range of no more than n+1 points defining the simplex.
Note
If your range is [itB,itE) = { (3,2), (1,7), (6,6) } and the denominator d = 4, then your polytope has vertices { (3/4,2/4), (1/4,7/4), (6/4,6/4) }.

Referenced by SCENARIO().

◆ makeRationalSimplex() [2/2]

template<typename TKSpace >
static RationalPolytope DGtal::DigitalConvexity< TKSpace >::makeRationalSimplex ( std::initializer_list< Point l)
static

Constructs a rational polytope from a simplex given as an initializer_list.

Parameters
lany list where the first point give the denominator and then no more than d+1 points in general positions.
Note
If your list is l = { (4,x), (3,2), (1,7), (6,6) }, then the denominator is d = 4 and your polytope has vertices { (3/4,2/4), (1/4,7/4), (6/4,6/4) }.

◆ makeSimplex() [1/2]

template<typename TKSpace >
template<typename PointIterator >
static LatticePolytope DGtal::DigitalConvexity< TKSpace >::makeSimplex ( PointIterator  itB,
PointIterator  itE 
)
static

Constructs a lattice polytope from a simplex given as a range [itB,itE) of lattice points. Note that the range must contain Space::dimension+1 points or less in general position.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
itBthe start of the range of no more than n+1 points defining the simplex.
itEpast the end the range of no more than n+1 points defining the simplex.

Referenced by main(), and SCENARIO().

◆ makeSimplex() [2/2]

template<typename TKSpace >
static LatticePolytope DGtal::DigitalConvexity< TKSpace >::makeSimplex ( std::initializer_list< Point l)
static

Constructs a lattice polytope from a simplex given as an initializer_list.

Parameters
lany list of no more than d+1 points in general positions.
Precondition
Note that the list must contain no more than Space::dimension+1 points in general position.

◆ operator=()

template<typename TKSpace >
Self & DGtal::DigitalConvexity< TKSpace >::operator= ( const Self other)
default

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ relativeEnvelope() [1/2]

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::relativeEnvelope ( const PointRange Z,
const PointRange Y,
EnvelopeAlgorithm  algo = EnvelopeAlgorithm::DIRECT 
) const

Computes the fully convex envelope of Z relative to fully convex digital set Y, i.e. \( FC^*_Y(Z):=FC_Y(FC_Y( \ldots FC_Y(Z) \ldots )) \) for Z a range of points, until stabilization of the iterative process.

Parameters
Zany range of points (must be sorted).
Yany range of points (must be sorted) that is fully convex.
algothe chosen method of computation.
Returns
\( FC^*_Y( Z ) \)
Note
If Z is fully convex, then the output is Z itself. Otherwise, the returned set of points includes Z and is fully convex.

Referenced by main(), and SCENARIO().

◆ relativeEnvelope() [2/2]

template<typename TKSpace >
template<typename Predicate >
PointRange DGtal::DigitalConvexity< TKSpace >::relativeEnvelope ( const PointRange Z,
const Predicate &  PredY,
EnvelopeAlgorithm  algo = EnvelopeAlgorithm::DIRECT 
) const

Computes the fully convex envelope of Z relative to fully convex digital set Y defined by a corresponding predicate PredY. It computes \( FC^*_Y(Z):=FC_Y(FC_Y( \ldots FC_Y(Z) \ldots )) \) for Z a range of points, until stabilization of the iterative process.

Template Parameters
Predicatethe type of a predicate Point -> boolean
Parameters
Zany range of points (must be sorted).
PredYa Point predicate such that PredY(p)==true iff p belongs to Y.
algothe chosen method of computation.
Returns
\( FC^*_Y( Z ) \)
Note
If Z is fully convex, then the output is Z itself. Otherwise, the returned set of points includes Z and is fully convex.

◆ selfDisplay()

template<typename TKSpace >
void DGtal::DigitalConvexity< TKSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ simplexType() [1/2]

template<typename TKSpace >
template<typename PointIterator >
static SimplexType DGtal::DigitalConvexity< TKSpace >::simplexType ( PointIterator  itB,
PointIterator  itE 
)
static

Returns the type of simplex formed by the given range [itB,itE) of lattice points.

Template Parameters
PointIteratorany model of forward iterator on Point.
Parameters
itBthe start of the range of n+1 points defining the simplex.
itEpast the end the range of n+1 points defining the simplex.
Returns
the type of simplex formed by the given range [itB,itE) of lattice points.

Referenced by SCENARIO().

◆ simplexType() [2/2]

template<typename TKSpace >
static SimplexType DGtal::DigitalConvexity< TKSpace >::simplexType ( std::initializer_list< Point l)
static

Returns the type of simplex formed by the given list l of lattice points.

Parameters
lany list of lattice points.
Returns
the type of simplex formed by the given list of lattice points.

◆ sizeStarCvxH()

template<typename TKSpace >
Integer DGtal::DigitalConvexity< TKSpace >::sizeStarCvxH ( const PointRange X) const

Computes the number of cells in Star(CvxH(X)) for X a digital set.

Parameters
Xany range of lattice points
Returns
the number of cells touching the convex hull of X, represented as lattice points with Khalimsky coordinates.

◆ Skel()

template<typename TKSpace >
LatticeSet DGtal::DigitalConvexity< TKSpace >::Skel ( const LatticeSet C) const
Parameters
Ca range of cells represented as a lattice set.
Returns
the set of cells, represented as a lattice set, that form the skeleton of the given range of cells C.

◆ space()

template<typename TKSpace >
const KSpace & DGtal::DigitalConvexity< TKSpace >::space ( ) const
Returns
a const reference to the cellular grid space used by this object.

Referenced by DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::NeighborhoodConvexityAnalyzer(), and DGtal::NeighborhoodConvexityAnalyzer< TKSpace, K >::space().

◆ Star()

template<typename TKSpace >
LatticeSet DGtal::DigitalConvexity< TKSpace >::Star ( const PointRange X,
Dimension  axis = dimension 
) const

Builds the cell complex Star(X) for X a digital set, represented as a lattice set (stacked row representation).

Parameters
Xany range of lattice points
axisspecifies the projection axis for the row representation if below space dimension, otherwise chooses the axis that minimizes memory/computations.
Returns
the set of cells, represented as a lattice set, that touches points of X, i.e. Star(X).
Note
It is useful to specify an axis if you wish later to compare or make operations with several lattice sets. They must indeed have the same axis.

◆ StarCells()

template<typename TKSpace >
LatticeSet DGtal::DigitalConvexity< TKSpace >::StarCells ( const PointRange C,
Dimension  axis = dimension 
) const

Builds the cell complex Star(C) for C a range of cells, represented as a lattice set (stacked row representation).

Parameters
Ca range of cells represented with points in Khalimsky coordinates.
axisspecifies the projection axis for the row representation if below space dimension, otherwise chooses the axis that minimizes memory/computations.
Returns
the set of cells, represented as a lattice set, that touches cells of C, i.e. Star(C).
Note
It is useful to specify an axis if you wish later to compare or make operations with several lattice sets. They must indeed have the same axis.

◆ StarCvxH()

template<typename TKSpace >
LatticeSet DGtal::DigitalConvexity< TKSpace >::StarCvxH ( const PointRange X,
Dimension  axis = dimension 
) const

Builds the cell complex Star(CvxH(X)) for X a digital set, represented as a lattice set (stacked row representation).

Parameters
Xany range of lattice points
axisspecifies the projection axis for the row representation if below space dimension, otherwise chooses the axis that minimizes memory/computations.
Returns
the range of cells touching the convex hull of X, represented as a lattice set (cells are represented with Khalimsky coordinates).
Note
It is useful to specify an axis if you wish later to compare or make operations with several lattice sets. They must indeed have the same axis.

Referenced by checkSkelStarCvxHFullConvexity(), and SCENARIO().

◆ toLatticeSet()

template<typename TKSpace >
LatticeSet DGtal::DigitalConvexity< TKSpace >::toLatticeSet ( const PointRange X,
Dimension  axis = dimension 
) const

Builds the lattice set (stacked row representation) associated to the given range of points.

Parameters
Xany range of lattice points
axisspecifies the projection axis for the row representation if below space dimension, otherwise chooses the axis that minimizes memory/computations.
Returns
the lattice set that represents the exact same points as X
Note
It is useful to specify an axis if you wish later to compare or make operations with several lattice sets. They must indeed have the same axis.

◆ toPointRange()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::toPointRange ( const LatticeSet L) const

Builds the range of lattice points associated to the given lattice set.

Parameters
Lany lattice set.
Returns
the point range that represents the exact same points as L

◆ U()

template<typename TKSpace >
PointRange DGtal::DigitalConvexity< TKSpace >::U ( Dimension  i,
const PointRange X 
) const

Performs the digital Minkowski sum of X along direction i

Parameters
iany valid dimension
Xany sorted range of digital points
Returns
the sorted range of digital points X union the translation of X of one along direction i.

Referenced by checkCvxHPlusHypercubeFullConvexity().

Field Documentation

◆ dimension

template<typename TKSpace >
const Dimension DGtal::DigitalConvexity< TKSpace >::dimension = KSpace::dimension
static

Definition at line 100 of file DigitalConvexity.h.

◆ myDepthLastFCE

template<typename TKSpace >
Size DGtal::DigitalConvexity< TKSpace >::myDepthLastFCE
mutableprotected

The number of iterations of the last FullyConvexEnvelope operation.

Definition at line 880 of file DigitalConvexity.h.

◆ myK

template<typename TKSpace >
KSpace DGtal::DigitalConvexity< TKSpace >::myK
protected

The cellular grid space where computations are done.

Definition at line 872 of file DigitalConvexity.h.

◆ mySafe

template<typename TKSpace >
bool DGtal::DigitalConvexity< TKSpace >::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 877 of file DigitalConvexity.h.


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