33 #if defined(KhalimskySpaceND_RECURSES)
34 #error Recursive header files inclusion detected in KhalimskySpaceND.h
35 #else // defined(KhalimskySpaceND_RECURSES)
37 #define KhalimskySpaceND_RECURSES
39 #if !defined KhalimskySpaceND_h
41 #define KhalimskySpaceND_h
49 #include <DGtal/base/Common.h>
50 #include <DGtal/kernel/CInteger.h>
51 #include <DGtal/kernel/PointVector.h>
52 #include <DGtal/kernel/SpaceND.h>
53 #include <DGtal/topology/KhalimskyPreSpaceND.h>
64 class KhalimskySpaceND;
70 template <
class TKhalimskySpace >
435 template <
typename CellType >
455 typedef std::map<Cell,Value>
Type;
461 typedef std::map<SCell,Value>
Type;
467 typedef std::map<SCell,Value>
Type;
558 const std::array<Closure, dim> & closure );
2094 #include "DGtal/topology/KhalimskySpaceND.ih"
2099 #endif // !defined KhalimskySpaceND_h
2101 #undef KhalimskySpaceND_RECURSES
2102 #endif // else defined(KhalimskySpaceND_RECURSES)
void uSetCoords(Cell &c, const Point &kp) const
Sets the digital coordinates of [c] to [kp].
std::string className() const
Return the style name used for drawing this object.
SCells sProperNeighborhood(const SCell &cell) const
Computes the proper 1-neighborhood of the cell [c] and returns it.
Integer uFirst(const PreCell &p, Dimension k) const
Return the k-th Khalimsky coordinate of the first cell of the space with the same type as [p].
static constexpr const Dimension dimension
bool uIsInside(const PreCell &p) const
Useful to check if you are going out of the space.
SignedKhalimskyCell & operator=(const SignedKhalimskyCell &other)=default
Copy operator.
@ PERIODIC
The dimension is periodic.
SCell sGetMax(SCell p, Dimension k) const
Useful to check if you are going out of the space.
SCell sAdjacent(const SCell &p, Dimension k, bool up) const
Return the adjacent element to [p] along axis [k] in the given direction and orientation.
AnyCellCollection< SCell > SCells
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
const Point & upperBound() const
Return the upper bound for digital points in this space.
void uProject(Cell &p, const Cell &bound, Dimension k) const
Projects [p] along the [k]th direction toward [bound].
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
SCell sIndirectIncident(const SCell &p, Dimension k) const
Return the indirect incident cell of [p] along [k] (the incident cell along [k] whose sign is negativ...
Cell uGetMin(Cell p, Dimension k) const
Useful to check if you are going out of the space.
bool sIsSurfel(const SCell &b) const
Return 'true' if [b] is a surfel (spans all but one coordinate).
Cell uCell(Point p, const PreCell &c) const
From the digital coordinates of a point in Zn and a cell type, builds the corresponding unsigned cell...
bool uIsOpen(const Cell &p, Dimension k) const
Return 'true' if [p] is open along the direction [k].
Dimension uDim(const Cell &p) const
Return the dimension of the cell [p].
Integer sLast(const SPreCell &p, Dimension k) const
Return the k-th Khalimsky coordinate of the last cell of the space with the same type as [p].
SignedKhalimskyCell(Integer dummy=0)
Default constructor.
KhalimskyCell(const PreCell &aCell)
Explicit constructor from a KhalimskyPreCell.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be a model of the concept CInteger.
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
bool sIsMax(const SCell &p, Dimension k) const
Useful to check if you are going out of the space.
bool uIsValid(const PreCell &c, Dimension k) const
Returns true if the given unsigned cell has his k-th Khalimsky coordinate between those of the cells ...
Cell uFirst(const PreCell &p) const
Return the first cell of the space with the same type as [p].
Closure
Boundaries closure type.
void uSetKCoords(Cell &c, const Point &kp) const
Sets the Khalimsky coordinates of [c] to [kp].
SCell sTranslation(const SCell &p, const Vector &vec) const
Add the vector [vec] to [p].
Vector lower(const Vector &z, unsigned int k)
SignedKhalimskyCell & operator=(SignedKhalimskyCell &&other)=default
Move operator.
Aim: The traits class for all models of Cinteger.
bool sIsInside(const SPreCell &p, Dimension k) const
Useful to check if you are going out of the space.
bool isSpacePeriodic() const
Return 'true' iff the space is periodic along every dimension.
bool uIsMax(const Cell &p, Dimension k) const
Useful to check if you are going out of the space.
bool isAnyDimensionPeriodic() const
Return 'true' iff the space is periodic along at least one dimension.
Cell uSpel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be a model of the concept CInteger.
SCell sGetMin(SCell p, Dimension k) const
Useful to check if you are going out of the space.
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Closure getClosure(Dimension k) const
Gets closure type.
Integer uCoord(const Cell &c, Dimension k) const
Return its digital coordinate along [k].
bool uIsValid(const PreCell &c) const
Returns true if the given unsigned cell has Khalimsky coordinates between those of the cells returned...
boost::int32_t int32_t
signed 32-bit integer.
Integer max(Dimension k) const
Return the maximal digital coordinate in the k-dimension.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
std::array< Closure, dimension > myClosure
const Cell & lowerCell() const
Return the lower bound for cells in this space.
Integer uLast(const PreCell &p, Dimension k) const
Return the k-th Khalimsky coordinate of the last cell of the space with the same type as [p].
AnyCellCollection< Cell > Cells
SCell sGetIncr(const SCell &p, Dimension k) const
Return the same element as [p] except for the incremented coordinate [k].
Dimension uOrthDir(const Cell &s) const
Given an unsigned surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel i...
SignedKhalimskyCell(const SignedKhalimskyCell &other)=default
Copy constructor.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be signed to characterize a ring.
KhalimskyCell & operator=(KhalimskyCell &&other)=default
Move operator.
bool init(const Point &lower, const Point &upper, const std::array< Closure, dim > &closure)
Specifies the upper and lower bounds for the maximal cells in this space.
SignedKhalimskyCell(SignedKhalimskyCell &&other)=default
Move constructor.
DGtal::uint32_t Dimension
void sSetSign(SCell &c, Sign s) const
Sets the sign of the cell.
static constexpr const Sign NEG
bool operator==(const KhalimskyCell &other) const
Equality operator.
KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > > Helper
Features basic operations on coordinates, especially for periodic dimensions.
SignedKhalimskyCell(const SPreCell &aCell)
Explicit constructor from a SignedKhalimskyPreCell.
Cells uProperNeighborhood(const Cell &cell) const
Computes the proper 1-neighborhood of the cell [c] and returns it.
Cells uUpperIncident(const Cell &c) const
Return the cells directly up incident to c in this space.
SCell sCell(const Point &kp, Sign sign=POS) const
From the Khalimsky coordinates of a cell and a sign, builds the corresponding signed cell lying into ...
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
KhalimskyPreCell< dim, Integer > PreCell
bool operator!=(const KhalimskyCell &other) const
Difference operator.
const Point & lowerBound() const
Return the lower bound for digital points in this space.
SignedKhalimskyPreCell< dim, Integer > SPreCell
SCell sSpel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
unsigned int dim(const Vector &z)
Point sCoords(const SCell &c) const
Return its digital coordinates.
static constexpr const Dimension DIM
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Integer uDistanceToMin(const Cell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
SCell sGetAdd(const SCell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] incremented with x.
bool sIsInside(const SPreCell &p) const
Useful to check if you are going out of the space.
void sSetCoord(SCell &c, Dimension k, Integer i) const
Sets the [k]-th digital coordinate of [c] to [i].
bool sDirect(const SCell &p, Dimension k) const
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
void uSetCoord(Cell &c, Dimension k, Integer i) const
Sets the [k]-th digital coordinate of [c] to [i].
Sign sSign(const SCell &c) const
Return its sign.
Cells uFaces(const Cell &c) const
Return the proper faces of [c] (chain of lower incidence) that belong to the space.
bool uIsMin(const Cell &p, Dimension k) const
Useful to check if you are going out of the space.
std::map< SCell, Value > Type
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
Integer uDistanceToMax(const Cell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
bool isSpacePeriodic(Dimension k) const
Return 'true' iff the space is periodic along the specified dimension.
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
~KhalimskySpaceND()
Destructor.
KhalimskyCell< dim, Integer > Cell
Aim: This class is a model of CPreCellularGridSpaceND. It represents the cubical grid as a cell compl...
KhalimskySpaceND(const KhalimskySpaceND &other)=default
Copy constructor.
PointVector< dim, Integer > Point
Integer sFirst(const SPreCell &p, Dimension k) const
Return the k-th coordinate of the first cell of the space with the same type as [p].
std::map< Cell, Value > Type
void uAddFaces(Cells &faces, const Cell &c, Dimension axis) const
Used by uFaces for computing incident faces.
SCells sLowerIncident(const SCell &c) const
Return the signed cells directly low incident to c in this space.
void uSetKCoord(Cell &c, Dimension k, Integer i) const
Sets the [k]-th Khalimsky coordinate of [c] to [i].
Cells uCoFaces(const Cell &c) const
Return the proper cofaces of [c] (chain of upper incidence) that belong to the space.
Integer sDistanceToMax(const SCell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
Integer sCoord(const SCell &c, Dimension k) const
Return its digital coordinate along [k].
SCell sDirectIncident(const SCell &p, Dimension k) const
Return the direct incident cell of [p] along [k] (the incident cell along [k])
Cell uLast(const PreCell &p) const
Return the last cell of the space with the same type as [p].
std::string className() const
Return the style name used for drawing this object.
KhalimskySpaceND< dim, Integer > CellularGridSpace
SignedKhalimskyCell< dim, Integer > SCell
bool isSpaceClosed() const
Return 'true' iff the space is closed or periodic along every dimension.
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Integer sDistanceToMin(const SCell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
bool sIsMin(const SCell &p, Dimension k) const
Useful to check if you are going out of the space.
bool operator==(const SignedKhalimskyCell &other) const
Equality operator.
DGtal is the top-level namespace which contains all DGtal functions and types.
SCell sLast(const SPreCell &p) const
Return the last cell of the space with the same type as [p].
bool uIsInside(const PreCell &p, Dimension k) const
Useful to check if you are going out of the space.
SCell sGetSub(const SCell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] decremented with x.
Internal class of KhalimskySpaceND that provides some optimizations depending on the space type.
SCell sPointel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
bool init(const Point &lower, const Point &upper, Closure closure)
Specifies the upper and lower bounds for the maximal cells in this space.
KhalimskySpaceND()
Default constructor.
DirIterator sOrthDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell does not span.
const Point & sKCoords(const SCell &c) const
Return its Khalimsky coordinates.
void sSetCoords(SCell &c, const Point &kp) const
Sets the digital coordinates of [c] to [kp].
SpaceND< dim, Integer > Space
KhalimskyCell(Integer dummy=0)
Default constructor.
SPreCell const & preCell() const
Returns the underlying constant signed pre-cell.
Integer uTopology(const Cell &p) const
Return the topology word of [p].
Cell uGetAdd(const Cell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] incremented with x.
Integer min(Dimension k) const
Return the minimal digital coordinate in the k-dimension.
@ CLOSED
The dimension is closed and non-periodic.
bool sIsValid(const SPreCell &c) const
Returns true if the given signed cell has Khalimsky coordinates between those of the cells returned b...
Integer sKCoord(const SCell &c, Dimension k) const
Return its Khalimsky coordinate along [k].
bool cIsInside(const Point &p, Dimension k) const
Useful to check if you are going out of the space.
KhalimskyCell(KhalimskyCell &&other)=default
Move constructor.
PreCell const & preCell() const
Returns the underlying constant pre-cell.
Point uCoords(const Cell &c) const
Return its digital coordinates.
void sSetKCoords(SCell &c, const Point &kp) const
Sets the Khalimsky coordinates of [c] to [kp].
Cells uNeighborhood(const Cell &cell) const
Computes the 1-neighborhood of the cell [c] and returns it.
SCell sProjection(const SCell &p, const SCell &bound, Dimension k) const
Return the projection of [p] along the [k]th direction toward [bound].
void uAddCoFaces(Cells &cofaces, const Cell &c, Dimension axis) const
Used by uCoFaces for computing incident cofaces.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DirIterator uDirs(const Cell &p) const
Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell spans.
KhalimskySpaceND & operator=(const KhalimskySpaceND &other)=default
Copy operator.
typename PreCellularGridSpace::template AnyCellCollection< CellType > AnyCellCollection
bool sIsOpen(const SCell &p, Dimension k) const
Return 'true' if [p] is open along the direction [k].
Integer sTopology(const SCell &p) const
Return the topology word of [p].
SCell sFirst(const SPreCell &p) const
Return the first cell of the space with the same type as [p].
typename PreCellularGridSpace::DirIterator DirIterator
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
bool cIsInside(const Point &p) const
Useful to check if you are going out of the space.
bool isSpaceClosed(Dimension k) const
Return 'true' iff the space is closed or periodic along the specified dimension.
KhalimskyCell & operator=(const KhalimskyCell &other)=default
Copy operator.
void sProject(SCell &p, const SCell &bound, Dimension k) const
Projects [p] along the [k]th direction toward [bound].
const Point & uKCoords(const Cell &c) const
Return its Khalimsky coordinates.
Cell uGetIncr(const Cell &p, Dimension k) const
Return the same element as [p] except for the incremented coordinate [k].
bool uIsSurfel(const Cell &b) const
Return 'true' if [b] is a surfel (spans all but one coordinate).
bool sIsValid(const SPreCell &c, Dimension k) const
Returns true if the given signed cell his k-th Khalimsky coordinate between those of the cells return...
Vector upper(const Vector &z, unsigned int k)
Cell uProjection(const Cell &p, const Cell &bound, Dimension k) const
Return the projection of [p] along the [k]th direction toward [bound].
KhalimskyPreSpaceND< dim, Integer > PreCellularGridSpace
SCell signs(const Cell &p, Sign s) const
Creates a signed cell from an unsigned one and a given sign.
DirIterator uOrthDirs(const Cell &p) const
Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell does not spa...
Cell uIncident(const Cell &c, Dimension k, bool up) const
Return the forward or backward unsigned cell incident to [c] along axis [k], depending on [up].
Cell uGetSub(const Cell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] decremented with x.
SCells sUpperIncident(const SCell &c) const
Return the signed cells directly up incident to c in this space.
Cell uAdjacent(const Cell &p, Dimension k, bool up) const
Return the adjacent element to [p] along axis [k] in the given direction and orientation.
SCells sNeighborhood(const SCell &cell) const
Computes the 1-neighborhood of the cell [c] and returns it.
@ OPEN
The dimension is open.
static constexpr const Sign POS
bool isValid() const
Checks the validity/consistency of the object.
bool operator<(const SignedKhalimskyCell &other) const
Inferior operator. (lexicographic order).
std::map< SCell, Value > Type
bool sNext(SCell &p, const SCell &lower, const SCell &upper) const
Increment the cell [p] to its next position (as classically done in a scanning).
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
SignedKhalimskyCell(const Point &aPoint, bool positive)
Explicit constructor from its Khalimsky coordinates.
SCell sIncident(const SCell &c, Dimension k, bool up) const
Return the forward or backward signed cell incident to [c] along axis [k], depending on [up].
Cell uCell(const Point &kp) const
From the Khalimsky coordinates of a cell, builds the corresponding unsigned cell lying into this Khal...
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
KhalimskyCell(const KhalimskyCell &other)=default
Copy constructor.
const Cell & upperCell() const
Return the upper bound for cells in this space.
SPreCell mySPreCell
Underlying signed pre-cell.
KhalimskyCell(const Point &aPoint)
Explicit constructor from its Khalimsky coordinates.
void selfDisplay(std::ostream &out) const
Writes/Displays the object on an output stream.
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
SCell sGetDecr(const SCell &p, Dimension k) const
Return the same element as [p] except for an decremented coordinate [k].
Cell uPointel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
Integer uKCoord(const Cell &c, Dimension k) const
Return its Khalimsky coordinate along [k].
bool cIsValid(const Point &p, Dimension k) const
Returns true if the given cell has his k-th Khalimsky coordinate between those of the cells returned ...
Dimension sDim(const SCell &p) const
Return the dimension of the cell [p].
PointVector< dim, Integer > Vector
bool cIsValid(const Point &p) const
Returns true if the given cell has Khalimsky coordinates between those of the cells returned by lower...
bool operator<(const KhalimskyCell &other) const
Inferior operator. (lexicographic order).
PreCellDirectionIterator< dim, Integer > DirIterator
Cells uLowerIncident(const Cell &c) const
Return the cells directly low incident to c in this space.
Cell uGetMax(Cell p, Dimension k) const
Useful to check if you are going out of the space.
bool operator!=(const SignedKhalimskyCell &other) const
Difference operator.
Cell uTranslation(const Cell &p, const Vector &vec) const
Add the vector [vec] to [p].
PreCell myPreCell
Underlying pre-cell.
KhalimskySpaceND(KhalimskySpaceND &&other)=default
Move constructor.
Cell uGetDecr(const Cell &p, Dimension k) const
Return the same element as [p] except for an decremented coordinate [k].
Represents an (unsigned) cell in a cellular grid space by its Khalimsky coordinates.
void sSetKCoord(SCell &c, Dimension k, Integer i) const
Sets the [k]-th Khalimsky coordinate of [c] to [i].
bool uNext(Cell &p, const Cell &lower, const Cell &upper) const
Increment the cell [p] to its next position (as classically done in a scanning).
SCell sCell(Point p, const SPreCell &c) const
From the digital coordinates of a point in Zn and a signed cell type, builds the corresponding signed...
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Size size(Dimension k) const
Return the width of the space in the k-dimension.
SCell sOpp(const SCell &p) const
Creates the signed cell with the inverse sign of [p].