30#if defined(KhalimskyPreSpaceND_RECURSES)
31#error Recursive header files inclusion detected in KhalimskyPreSpaceND.h
34#define KhalimskyPreSpaceND_RECURSES
36#if !defined KhalimskyPreSpaceND_h
38#define KhalimskyPreSpaceND_h
45#include <DGtal/base/Common.h>
46#include <DGtal/kernel/CInteger.h>
47#include <DGtal/kernel/PointVector.h>
48#include <DGtal/kernel/SpaceND.h>
60 class KhalimskyPreSpaceND;
408 template <
typename CellType>
412 using Iterator =
typename std::deque<CellType>::iterator;
433 typedef std::map<Cell,Value>
Type;
439 typedef std::map<SCell,Value>
Type;
445 typedef std::map<SCell,Value>
Type;
1433#include "DGtal/topology/KhalimskyPreSpaceND.ih"
1440#undef KhalimskyPreSpaceND_RECURSES
Aim: This class is a model of CPreCellularGridSpaceND. It represents the cubical grid as a cell compl...
static Point exteriorVoxel(const SCell &c)
For a given surfel ((n-1)-signed cell), returns its exterior voxel (point in Z^d given by the indirec...
static Integer uTopology(const Cell &p)
Return the topology word of [p].
static bool sIsInside(const SCell &p, Dimension k)
Useful to check if you are going out of the space.
static Point uCoords(const Cell &c)
Return its digital coordinates.
static bool uIsInside(const Cell &p)
Useful to check if you are going out of the space.
static const Point & sKCoords(const SCell &c)
Return its Khalimsky coordinates.
static constexpr bool isValid()
Checks the validity/consistency of the object.
static SCells sProperNeighborhood(const SCell &cell)
Computes the proper 1-neighborhood of the pre-cell [c] and returns it.
static constexpr const Sign NEG
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
static void uProject(Cell &p, const Cell &bound, Dimension k)
Projects [p] along the [k]th direction toward [bound].
static SCell sAdjacent(const SCell &p, Dimension k, bool up)
Return the adjacent element to [p] along axis [k] in the given direction and orientation.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be signed to characterize a ring.
static bool sIsMax(const SCell &p, Dimension k)
Useful to check if you are going out of the space.
static bool sIsSurfel(const SCell &b)
Return 'true' if [b] is a surfel (spans all but one coordinate).
static constexpr const Dimension dimension
static bool uIsInside(const Cell &p, Dimension k)
Useful to check if you are going out of the space.
static Cells uFaces(const Cell &c)
Return the proper faces of [c] (chain of lower incidence).
static void sSetKCoord(SCell &c, Dimension k, Integer i)
Sets the [k]-th Khalimsky coordinate of [c] to [i].
static void uSetCoords(Cell &c, const Point &kp)
Sets the digital coordinates of [c] to [kp].
static DirIterator sOrthDirs(const SCell &p)
Given a signed pre-cell [p], returns an iterator to iterate over each coordinate the cell does not sp...
static bool sIsMin(const SCell &p, Dimension k)
Useful to check if you are going out of the space.
static Dimension uOrthDir(const Cell &s)
Given an unsigned pre-surfel [s], returns its orthogonal direction (ie, the coordinate where the surf...
static Cells uCoFaces(const Cell &c)
Return the proper cofaces of [c] (chain of upper incidence).
static SCell sOpp(const SCell &p)
Creates the signed pre-cell with the inverse sign of [p].
static Cells uLowerIncident(const Cell &c)
Return the pre-cells directly low incident to c.
static void sProject(SCell &p, const SCell &bound, Dimension k)
Projects [p] along the [k]th direction toward [bound].
static void uAddCoFaces(Cells &cofaces, const Cell &c, Dimension axis)
Used by uCoFaces for computing incident cofaces.
static SCell sIndirectIncident(SCell p, Dimension k)
Return the indirect incident pre-cell of [p] along [k] (the incident cell along [k] whose sign is neg...
static SCells sLowerIncident(const SCell &c)
Return the signed pre-cells directly low incident to c.
static void sSetCoord(SCell &c, Dimension k, Integer i)
Sets the [k]-th digital coordinate of [c] to [i].
static Cell uProjection(Cell p, const Cell &bound, Dimension k)
Return the projection of [p] along the [k]th direction toward [bound].
static void uSetKCoord(Cell &c, Dimension k, Integer i)
Sets the [k]-th Khalimsky coordinate of [c] to [i].
static SCell sDirectIncident(SCell p, Dimension k)
Return the direct incident pre-cell of [p] along [k] (the incident pre-cell along [k])
static bool uIsMax(const Cell &p, Dimension k)
Useful to check if you are going out of the space.
static constexpr const Sign POS
static SCell signs(const Cell &p, Sign s)
Creates a signed pre-cell from an unsigned one and a given sign.
static Dimension uDim(const Cell &p)
Return the dimension of the pre-cell [p].
static void sSetCoords(SCell &c, const Point &kp)
Sets the digital coordinates of [c] to [kp].
static Point sCoords(const SCell &c)
Return its digital coordinates.
static bool uIsMin(const Cell &p, Dimension k)
Useful to check if you are going out of the space.
static bool uIsOpen(const Cell &p, Dimension k)
Return 'true' if [p] is open along the direction [k].
static Point interiorVoxel(const SCell &c)
For a given surfel ((n-1)-signed cell), returns its interior voxel (point in Z^d given by the direct ...
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
static Integer uKCoord(const Cell &c, Dimension k)
Return its Khalimsky coordinate along [k].
static Integer sCoord(const SCell &c, Dimension k)
Return its digital coordinate along [k].
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
static SCell sSpel(Point p, Sign sign=POS)
From the digital coordinates of a point in Zn, builds the corresponding pre-spel (pre-cell of maximal...
static Integer uCoord(const Cell &c, Dimension k)
Return its digital coordinate along [k].
static SCell sGetIncr(SCell p, Dimension k)
Return the same element as [p] except for the incremented coordinate [k].
static Cell uGetSub(Cell p, Dimension k, Integer x)
Return the same element as [p] except for a coordinate [k] decremented with x.
static Cells uProperNeighborhood(const Cell &cell)
Computes the proper 1-neighborhood of the pre-cell [c] and returns it.
static SCell sIncident(SCell c, Dimension k, bool up)
Return the forward or backward signed pre-cell incident to [c] along axis [k], depending on [up].
static bool sIsInside(const SCell &p)
Useful to check if you are going out of the space.
static void sSetSign(SCell &c, Sign s)
Sets the sign of the pre-cell.
static Cell uTranslation(Cell p, const Vector &vec)
Add the vector [vec] to [p].
static DirIterator sDirs(const SCell &p)
Given a signed pre-cell [p], returns an iterator to iterate over each coordinate the cell spans....
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static void uAddFaces(Cells &faces, const Cell &c, Dimension axis)
Used by uFaces for computing incident faces.
static Cell unsigns(const SCell &p)
Creates an unsigned pre-cell from a signed one.
static Integer sKCoord(const SCell &c, Dimension k)
Return its Khalimsky coordinate along [k].
static Dimension sDim(const SCell &p)
Return the dimension of the pre-cell [p].
static bool uNext(Cell &p, const Cell &lower, const Cell &upper)
Increment the pre-cell [p] to its next position (as classically done in a scanning).
static Cells uNeighborhood(const Cell &cell)
Computes the 1-neighborhood of the pre-cell [c] and returns it.
static Dimension sOrthDir(const SCell &s)
Given a signed pre-surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel ...
static Cell uAdjacent(const Cell &p, Dimension k, bool up)
Return the adjacent element to [p] along axis [k] in the given direction and orientation.
SignedKhalimskyPreCell< dim, Integer > SCell
static Cell uSpel(Point p)
From the digital coordinates of a point in Zn, builds the corresponding pre-spel (pre-cell of maximal...
static Cell uGetIncr(Cell p, Dimension k)
Return the same element as [p] except for the incremented coordinate [k].
static Cell uGetDecr(Cell p, Dimension k)
Return the same element as [p] except for an decremented coordinate [k].
static SCells sUpperIncident(const SCell &c)
Return the signed pre-cells directly up incident to c.
static SCells sNeighborhood(const SCell &cell)
Computes the 1-neighborhood of the pre-cell [c] and returns it.
static SCell sCell(const Point &kp, Sign sign=POS)
From the Khalimsky coordinates of a cell and a sign, builds the corresponding signed pre-cell.
static bool uIsSurfel(const Cell &b)
Return 'true' if [b] is a surfel (spans all but one coordinate).
static SCell sCell(Point p, const SCell &c)
From the digital coordinates of a point in Zn and a signed cell type, builds the corresponding signed...
static Cell uIncident(Cell c, Dimension k, bool up)
Return the forward or backward unsigned pre-cell incident to [c] along axis [k], depending on [up].
static SCell sGetAdd(SCell p, Dimension k, Integer x)
Return the same element as [p] except for a coordinate [k] incremented with x.
static bool sIsOpen(const SCell &p, Dimension k)
Return 'true' if [p] is open along the direction [k].
static void selfDisplay(std::ostream &out)
Writes/Displays the object on an output stream.
static Cell uGetAdd(Cell p, Dimension k, Integer x)
Return the same element as [p] except for a coordinate [k] incremented with x.
static bool sNext(SCell &p, const SCell &lower, const SCell &upper)
Increment the pre-cell [p] to its next position (as classically done in a scanning).
static void uSetCoord(Cell &c, Dimension k, Integer i)
Sets the [k]-th digital coordinate of [c] to [i].
static void uSetKCoords(Cell &c, const Point &kp)
Sets the Khalimsky coordinates of [c] to [kp].
static DirIterator uDirs(const Cell &p)
Given an unsigned pre-cell [p], returns an iterator to iterate over each coordinate the cell spans....
static SCell sGetSub(SCell p, Dimension k, Integer x)
Return the same element as [p] except for a coordinate [k] decremented with x.
static const Point & uKCoords(const Cell &c)
Return its Khalimsky coordinates.
static SCell sProjection(SCell p, const SCell &bound, Dimension k)
Return the projection of [p] along the [k]th direction toward [bound].
static void sSetKCoords(SCell &c, const Point &kp)
Sets the Khalimsky coordinates of [c] to [kp].
static SCell sGetDecr(SCell p, Dimension k)
Return the same element as [p] except for an decremented coordinate [k].
static constexpr const Dimension DIM
static Sign sSign(const SCell &c)
Return its sign.
static SCell sTranslation(SCell p, const Vector &vec)
Add the vector [vec] to [p].
static Cells uUpperIncident(const Cell &c)
Return the pre-cells directly up incident to c.
static Cell uCell(Point p, const Cell &c)
From the digital coordinates of a point in Zn and a cell type, builds the corresponding unsigned pre-...
static Integer sTopology(const SCell &p)
Return the topology word of [p].
static Cell uPointel(Point p)
From the digital coordinates of a point in Zn, builds the corresponding pre-pointel (pre-cell of dime...
static SCell sPointel(Point p, Sign sign=POS)
From the digital coordinates of a point in Zn, builds the corresponding pre-pointel (pre-cell of dime...
static DirIterator uOrthDirs(const Cell &p)
Given an unsigned pre-cell [p], returns an iterator to iterate over each coordinate the cell does not...
static Cell uCell(const Point &kp)
From the Khalimsky coordinates of a cell, builds the corresponding unsigned pre-cell.
static bool sDirect(const SCell &p, Dimension k)
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
This class is useful for looping on all "interesting" coordinates of a pre-cell.
Dimension myDir
the current direction.
PreCellDirectionIterator(Cell cell, bool open=true)
Constructor from a pre-cell.
KhalimskyPreCell< dim, Integer > Cell
SignedKhalimskyPreCell< dim, Integer > SCell
void find()
Look for next valid coordinate.
bool end() const
Return 'true' if the iteration is ended.
PreCellDirectionIterator(SCell scell, bool open=true)
Constructor from a signed pre-cell.
bool myOpen
If 'true', returns open coordinates, otherwise returns closed coordinates.
bool operator!=(const Integer) const
Fast comparison with unsigned integer (unused parameter).
bool operator!=(const PreCellDirectionIterator &other) const
Slow comparison with other iterator. Useful to check for end of loop.
PreCellDirectionIterator & operator++()
Pre-increment. Go to next direction.
Dimension operator*() const
Return the current direction.
bool operator==(const PreCellDirectionIterator &other) const
Slow comparison with other iterator.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
boost::int32_t int32_t
signed 32-bit integer.
Represents an unsigned cell in an unbounded cellular grid space by its Khalimsky coordinates.
KhalimskyPreCell(KhalimskyPreCell &&aCell)=default
Move constructor.
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
bool operator!=(const KhalimskyPreCell &other) const
Difference operator.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be a model of the concept CInteger.
PreCell const & preCell() const
Returns the underlying constant pre-cell, itself in fact.
std::string className() const
Return the style name used for drawing this object.
KhalimskyPreCell(KhalimskyPreCell const &aCell)=default
Copy constructor.
KhalimskyPreCell< dim, Integer > Self
KhalimskyPreCell & operator=(KhalimskyPreCell &&aCell)=default
Move operator.
KhalimskyPreCell(Point const &aPoint)
Implicit constructor from its Khalimsky coordinates.
bool operator==(const KhalimskyPreCell &other) const
Equality operator.
Point coordinates
Khalimsky coordinates of the cell. Public to allow easy coordinate manipulations.
KhalimskyPreCell & operator=(KhalimskyPreCell const &aCell)=default
Copy operator.
KhalimskyPreSpaceND< dim, TInteger > PreCellularGridSpace
KhalimskyPreCell(Integer dummy=0)
Default constructor.
bool operator<(const KhalimskyPreCell &other) const
Inferior operator. (lexicographic order).
typename std::deque< CellType > Container
typename std::deque< CellType >::const_iterator ConstIterator
typename std::deque< CellType >::iterator Iterator
std::map< Cell, Value > Type
std::map< SCell, Value > Type
std::map< SCell, Value > Type
Represents a signed cell in an unbounded cellular grid space by its Khalimsky coordinates and a boole...
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
bool operator!=(const SignedKhalimskyPreCell &other) const
Difference operator.
std::string className() const
Return the style name used for drawing this object.
SignedKhalimskyPreCell(Point const &aPoint, bool positive)
Implicit constructor from its Khalimsky coordinates.
SignedKhalimskyPreCell< dim, Integer > Self
Point coordinates
Khalimsky coordinates of the cell.
SignedKhalimskyPreCell(SignedKhalimskyPreCell &&aCell)=default
Move constructor.
bool operator<(const SignedKhalimskyPreCell &other) const
Inferior operator. (lexicographic order).
SignedKhalimskyPreCell & operator=(SignedKhalimskyPreCell const &aCell)=default
Copy operator.
SignedKhalimskyPreCell(Integer dummy=0)
Default constructor.
SPreCell const & preCell() const
Returns the underlying constant pre-cell, itself in fact.
SignedKhalimskyPreCell & operator=(SignedKhalimskyPreCell &&aCell)=default
Move operator.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
bool operator==(const SignedKhalimskyPreCell &other) const
Equality operator.
KhalimskyPreSpaceND< dim, TInteger > PreCellularGridSpace
SignedKhalimskyPreCell(SignedKhalimskyPreCell const &aCell)=default
Copy constructor.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)