DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::CellGeometry< TKSpace > Class Template Reference

Aim: Computes and stores sets of cells and provides methods to compute intersections of lattice and rational polytopes with cells. More...

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

Inheritance diagram for DGtal::CellGeometry< TKSpace >:
[legend]

Public Types

typedef CellGeometry< 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 KSpace::Size Size
 
typedef DGtal::BigInteger BigInteger
 
typedef DGtal::BoundedLatticePolytope< SpacePolytope
 
typedef DGtal::BoundedLatticePolytope< SpaceLatticePolytope
 
typedef DGtal::BoundedRationalPolytope< SpaceRationalPolytope
 

Public Member Functions

Standard services (construction, initialization, assignment)
 ~CellGeometry ()=default
 
 CellGeometry ()
 
 CellGeometry (const Self &other)=default
 
 CellGeometry (Self &&other)=default
 
 CellGeometry (const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
 
Selfoperator= (const Self &other)=default
 
void init (const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
 
Cells services
void addCellsTouchingPoint (const Point &p)
 
void addCellsTouchingPointel (const Cell &pointel)
 
void addCellsTouchingCell (const Cell &c)
 
void addCellsTouchingSegment (const Point &a, const Point &b)
 
template<typename PointIterator >
void addCellsTouchingPoints (PointIterator itB, PointIterator itE)
 
template<typename PointelIterator >
void addCellsTouchingPointels (PointelIterator itB, PointelIterator itE)
 
void addCellsTouchingPolytopePoints (const LatticePolytope &polytope)
 
void addCellsTouchingPolytopePoints (const RationalPolytope &polytope)
 
void addCellsTouchingPolytope (const LatticePolytope &polytope)
 
void addCellsTouchingPolytope (const RationalPolytope &polytope)
 
CellGeometryoperator+= (const CellGeometry &other)
 
Accessor services
Size nbCells () const
 
Size computeNbCells (const Dimension k) const
 
Integer computeEuler () const
 
Dimension minCellDim () const
 
Dimension maxCellDim () const
 
std::vector< PointgetKPoints (const Dimension k) const
 
Cell services
bool subset (const CellGeometry &other) const
 
bool subset (const CellGeometry &other, const Dimension k) const
 
Helper services
std::vector< PointgetIntersectedKPoints (const LatticePolytope &polytope, const Dimension i) const
 
std::vector< PointgetIntersectedKPoints (const RationalPolytope &polytope, const Dimension i) const
 
std::vector< PointgetTouchedKPoints (const std::vector< Point > &points, const Dimension i) const
 
std::vector< CellgetIntersectedCells (const LatticePolytope &polytope, const Dimension i) const
 
std::vector< CellgetIntersectedCells (const RationalPolytope &polytope, const Dimension i) const
 
std::vector< CellgetTouchedCells (const std::vector< Point > &points, const Dimension i) const
 
Interface services
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
std::string className () const
 

Static Public Member Functions

Khalimsky point services
static Dimension dim (const Point &kp)
 

Static Public Attributes

static const Dimension dimension = KSpace::dimension
 

Protected Attributes

KSpace myK
 The cellular space for cells.
 
UnorderedSetByBlock< Point, Splitter< Point, uint64_t > > myKPoints
 The unordered set that stores cells.
 
Dimension myMinCellDim
 The minimum cell dimension.
 
Dimension myMaxCellDim
 The maximal cell dimension.
 
bool myVerbose
 Tells if verbose mode.
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CCellularGridSpaceND< TKSpace >))
 

Static Private Member Functions

template<typename RandomIterator >
static bool includes (RandomIterator it2, RandomIterator itE2, RandomIterator it1, RandomIterator itE1)
 

Detailed Description

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

Aim: Computes and stores sets of cells and provides methods to compute intersections of lattice and rational polytopes with cells.

Description of template class 'CellGeometry'

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

Template Parameters
TKSpacean arbitrary model of CCellularGridSpaceND.

Definition at line 74 of file CellGeometry.h.

Member Typedef Documentation

◆ BigInteger

template<typename TKSpace >
typedef DGtal::BigInteger DGtal::CellGeometry< TKSpace >::BigInteger

Definition at line 88 of file CellGeometry.h.

◆ Cell

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

Definition at line 84 of file CellGeometry.h.

◆ Integer

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

Definition at line 81 of file CellGeometry.h.

◆ KSpace

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

Definition at line 80 of file CellGeometry.h.

◆ LatticePolytope

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

Definition at line 93 of file CellGeometry.h.

◆ Point

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

Definition at line 82 of file CellGeometry.h.

◆ Polytope

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

Definition at line 92 of file CellGeometry.h.

◆ RationalPolytope

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

Definition at line 94 of file CellGeometry.h.

◆ Self

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

Definition at line 79 of file CellGeometry.h.

◆ Size

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

Definition at line 86 of file CellGeometry.h.

◆ Space

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

Definition at line 85 of file CellGeometry.h.

◆ Vector

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

Definition at line 83 of file CellGeometry.h.

Constructor & Destructor Documentation

◆ ~CellGeometry()

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

Destructor.

◆ CellGeometry() [1/4]

template<typename TKSpace >
DGtal::CellGeometry< TKSpace >::CellGeometry ( )

Constructor.

◆ CellGeometry() [2/4]

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

Copy constructor.

Parameters
otherthe object to clone.

◆ CellGeometry() [3/4]

template<typename TKSpace >
DGtal::CellGeometry< TKSpace >::CellGeometry ( Self && other)
default

Move constructor.

Parameters
otherthe object to move.

◆ CellGeometry() [4/4]

template<typename TKSpace >
DGtal::CellGeometry< TKSpace >::CellGeometry ( const KSpace & K,
Dimension min_cell_dim = 0,
Dimension max_cell_dim = KSpace::dimension,
bool verbose = false )

Constructor from cellular space.

Parameters
Kany cellular grid space.
min_cell_dimthe minimum cell dimension that is used for processing.
max_cell_dimthe maximal cell dimension that is used for processing (K::dimension - 1 is sufficient to check convexity).
verbosetells if verbose mode.

Member Function Documentation

◆ addCellsTouchingCell()

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingCell ( const Cell & c)

Updates the cell cover with the cells whose boundary covers cell c (so c itself and its up-incident cells).

Parameters
cany any cell

◆ addCellsTouchingPoint()

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPoint ( const Point & p)

Updates the cell cover with the cells touching a point p.

Parameters
pany point

◆ addCellsTouchingPointel()

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPointel ( const Cell & pointel)

Updates the cell cover with the cells touching a pointel pointel.

Parameters
pointelany pointel

◆ addCellsTouchingPointels()

template<typename TKSpace >
template<typename PointelIterator >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPointels ( PointelIterator itB,
PointelIterator itE )

Updates the cell cover with the cells touching a range of digital pointels [itB, itE).

◆ addCellsTouchingPoints()

template<typename TKSpace >
template<typename PointIterator >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPoints ( PointIterator itB,
PointIterator itE )

Updates the cell cover with the cells touching a range of digital points [itB, itE).

◆ addCellsTouchingPolytope() [1/2]

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPolytope ( const LatticePolytope & polytope)

Updates the cell cover with all the cells touching the lattice polytope (all cells whose closure have a non empty intersection with the polytope).

Parameters
polytopethe lattice polytope

◆ addCellsTouchingPolytope() [2/2]

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPolytope ( const RationalPolytope & polytope)

Updates the cell cover with all the cells touching the rational polytope (all cells whose closure have a non empty intersection with the polytope).

Parameters
polytopethe rational polytope

◆ addCellsTouchingPolytopePoints() [1/2]

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPolytopePoints ( const LatticePolytope & polytope)

Updates the cell cover with the cells touching the lattice points of a polytope.

Parameters
polytopethe lattice polytope

◆ addCellsTouchingPolytopePoints() [2/2]

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingPolytopePoints ( const RationalPolytope & polytope)

Updates the cell cover with the cells touching the lattice points of a rational polytope.

Parameters
polytopethe rational polytope

◆ addCellsTouchingSegment()

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::addCellsTouchingSegment ( const Point & a,
const Point & b )

Given two points a and b, updates the cell cover with all the cells intersected by the Euclidean straight segment from a to b.

Parameters
aany point
bany point
Note
Three times faster than building a (degenerated) lattice polytope and then calling addCellsTouchingPolytope.

◆ BOOST_CONCEPT_ASSERT()

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

◆ className()

template<typename TKSpace >
std::string DGtal::CellGeometry< TKSpace >::className ( ) const
Returns
the class name. It is notably used for drawing this object.

◆ computeEuler()

template<typename TKSpace >
Integer DGtal::CellGeometry< TKSpace >::computeEuler ( ) const
Returns
computes and return the Euler chracteristic of this set of cells.

◆ computeNbCells()

template<typename TKSpace >
Size DGtal::CellGeometry< TKSpace >::computeNbCells ( const Dimension k) const
Parameters
kany non negative integer
Returns
computes and returns the number of k-dimensional cells in this cell geometry.

◆ dim()

template<typename TKSpace >
static Dimension DGtal::CellGeometry< TKSpace >::dim ( const Point & kp)
static
Parameters
kpa Khalimsky point (i.e. an integer point whose coordinates parities correspond to cells).
Returns
the dimension of the cell associated to this Khalimsky point.

◆ getIntersectedCells() [1/2]

template<typename TKSpace >
std::vector< Cell > DGtal::CellGeometry< TKSpace >::getIntersectedCells ( const LatticePolytope & polytope,
const Dimension i ) const

Given a lattice polytope, such that polytope.canBeSummed()==true, return the i-cells that intersect it.

Parameters
polytopeany lattice polytope such that polytope.canBeSummed() == true
iany integer between 0 and KSpace::dimension
Returns
the i-cells that intersect this polytope.

◆ getIntersectedCells() [2/2]

template<typename TKSpace >
std::vector< Cell > DGtal::CellGeometry< TKSpace >::getIntersectedCells ( const RationalPolytope & polytope,
const Dimension i ) const

Given a rational polytope, such that polytope.canBeSummed()==true, return the i-cells that intersect it.

Parameters
polytopeany rational polytope such that polytope.canBeSummed() == true
iany integer between 0 and KSpace::dimension
Returns
the i-cells that intersect this polytope.

◆ getIntersectedKPoints() [1/2]

template<typename TKSpace >
std::vector< Point > DGtal::CellGeometry< TKSpace >::getIntersectedKPoints ( const LatticePolytope & polytope,
const Dimension i ) const

Given a lattice polytope, such that polytope.canBeSummed()==true, return the i-kpoints that intersect it.

Parameters
polytopeany lattice polytope such that polytope.canBeSummed() == true
iany integer between 0 and KSpace::dimension
Returns
the i-kpoints that intersect this polytope.

◆ getIntersectedKPoints() [2/2]

template<typename TKSpace >
std::vector< Point > DGtal::CellGeometry< TKSpace >::getIntersectedKPoints ( const RationalPolytope & polytope,
const Dimension i ) const

Given a rational polytope, such that polytope.canBeSummed()==true, return the i-kpoints that intersect it.

Parameters
polytopeany rational polytope such that polytope.canBeSummed() == true
iany integer between 0 and KSpace::dimension
Returns
the i-kpoints that intersect this polytope.

◆ getKPoints()

template<typename TKSpace >
std::vector< Point > DGtal::CellGeometry< TKSpace >::getKPoints ( const Dimension k) const
Parameters
kany non negative integer
Returns
the vector of k-cells, represented as points with Khalimsky coordinates.

◆ getTouchedCells()

template<typename TKSpace >
std::vector< Cell > DGtal::CellGeometry< TKSpace >::getTouchedCells ( const std::vector< Point > & points,
const Dimension i ) const

Given a vector of points, return the i-cells that touch it.

Parameters
pointsany vector of points
iany integer between 0 and KSpace::dimension (and limited to 5-D at most).
Returns
the i-cells that intersect this polytope.

◆ getTouchedKPoints()

template<typename TKSpace >
std::vector< Point > DGtal::CellGeometry< TKSpace >::getTouchedKPoints ( const std::vector< Point > & points,
const Dimension i ) const

Given a vector of points, return the i-kpoints that touch it.

Parameters
pointsany vector of points
iany integer between 0 and KSpace::dimension (and limited to 5-D at most).
Returns
the i-kpoints that intersect this polytope.

◆ includes()

template<typename TKSpace >
template<typename RandomIterator >
static bool DGtal::CellGeometry< TKSpace >::includes ( RandomIterator it2,
RandomIterator itE2,
RandomIterator it1,
RandomIterator itE1 )
staticprivate

◆ init()

template<typename TKSpace >
void DGtal::CellGeometry< TKSpace >::init ( const KSpace & K,
Dimension min_cell_dim = 0,
Dimension max_cell_dim = KSpace::dimension,
bool verbose = false )

Initialization from cellular space. If there was cells stored in this object, they are removed.

Parameters
Kany cellular grid space.
min_cell_dimthe minimum cell dimension that is used for processing.
max_cell_dimthe maximal cell dimension that is used for processing (K::dimension - 1 is sufficient to check convexity)
verbosetells if verbose mode.

◆ isValid()

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

Checks the validity/consistency of the object.

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

◆ maxCellDim()

template<typename TKSpace >
Dimension DGtal::CellGeometry< TKSpace >::maxCellDim ( ) const
Returns
the highest dimension for which cells are stored in this object.

◆ minCellDim()

template<typename TKSpace >
Dimension DGtal::CellGeometry< TKSpace >::minCellDim ( ) const
Returns
the smallest dimension for which cells are stored in this object.

◆ nbCells()

template<typename TKSpace >
Size DGtal::CellGeometry< TKSpace >::nbCells ( ) const
Returns
the total number of cells in this cell geometry.

◆ operator+=()

template<typename TKSpace >
CellGeometry & DGtal::CellGeometry< TKSpace >::operator+= ( const CellGeometry< TKSpace > & other)

Adds the cells of dimension k of object other, for minCellDim() <= k <= maxCellDim(), to this cell geometry.

Parameters
otherany cell geometry.
Returns
a reference to this object.

◆ operator=()

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

Assignment.

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

◆ selfDisplay()

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

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ subset() [1/2]

template<typename TKSpace >
bool DGtal::CellGeometry< TKSpace >::subset ( const CellGeometry< TKSpace > & other) const

Tells if the cells of 'this' are subset of the cells of other, for all valid dimensions of 'this' (i.e. from myMinCellDim till myMaxCellDim).

Parameters
otherany cell geometry object
Returns
'true' iff the cells of 'this' are subset of the cells of other.
Note
if other.maxCellDim() < k or k < other.minCellDim() then it means that other contains no cell of dimension k.

◆ subset() [2/2]

template<typename TKSpace >
bool DGtal::CellGeometry< TKSpace >::subset ( const CellGeometry< TKSpace > & other,
const Dimension k ) const

Tells if the k-cells of 'this' are subset of the k-cells of other.

Parameters
otherany cell geometry object
kany valid dimension for cells (0 <= k <= KSpace::dimension)
Returns
'true' iff the k-cells of 'this' are subset of the k-cells of other.
Note
if other.maxCellDim() < k or k < other.minCellDim() then it means that other contains no cell of dimension k.

Field Documentation

◆ dimension

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

Definition at line 96 of file CellGeometry.h.

◆ myK

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

The cellular space for cells.

Definition at line 381 of file CellGeometry.h.

◆ myKPoints

template<typename TKSpace >
UnorderedSetByBlock< Point, Splitter< Point, uint64_t> > DGtal::CellGeometry< TKSpace >::myKPoints
protected

The unordered set that stores cells.

Definition at line 384 of file CellGeometry.h.

◆ myMaxCellDim

template<typename TKSpace >
Dimension DGtal::CellGeometry< TKSpace >::myMaxCellDim
protected

The maximal cell dimension.

Definition at line 388 of file CellGeometry.h.

◆ myMinCellDim

template<typename TKSpace >
Dimension DGtal::CellGeometry< TKSpace >::myMinCellDim
protected

The minimum cell dimension.

Definition at line 386 of file CellGeometry.h.

◆ myVerbose

template<typename TKSpace >
bool DGtal::CellGeometry< TKSpace >::myVerbose
protected

Tells if verbose mode.

Definition at line 390 of file CellGeometry.h.


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