DGtal  1.3.beta
Data Structures | Public Types | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends
DGtal::KhalimskySpaceND< dim, TInteger > Class Template Reference

Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex, whose cells are defined as an array of integers. The topology of the cells is defined by the parity of the coordinates (even: closed, odd: open). More...

#include <DGtal/topology/KhalimskySpaceND.h>

Inheritance diagram for DGtal::KhalimskySpaceND< dim, TInteger >:
[legend]

Data Structures

struct  CellMap
 
struct  SCellMap
 
struct  SurfelMap
 

Public Types

enum  Closure { CLOSED, OPEN, PERIODIC }
 Boundaries closure type. More...
 
typedef TInteger Integer
 Arithmetic ring induced by (+,-,*) and Integer numbers. More...
 
typedef NumberTraits< Integer >::UnsignedVersion Size
 Type used to represent sizes in the digital space. More...
 
typedef SpaceND< dim, IntegerSpace
 
typedef KhalimskySpaceND< dim, IntegerCellularGridSpace
 
typedef KhalimskyPreSpaceND< dim, IntegerPreCellularGridSpace
 
typedef KhalimskyCell< dim, IntegerCell
 
typedef KhalimskyPreCell< dim, IntegerPreCell
 
typedef SignedKhalimskyCell< dim, IntegerSCell
 
typedef SignedKhalimskyPreCell< dim, IntegerSPreCell
 
typedef SCell Surfel
 
typedef bool Sign
 
using DirIterator = typename PreCellularGridSpace::DirIterator
 
typedef PointVector< dim, IntegerPoint
 
typedef PointVector< dim, IntegerVector
 
template<typename CellType >
using AnyCellCollection = typename PreCellularGridSpace::template AnyCellCollection< CellType >
 
typedef AnyCellCollection< CellCells
 
typedef AnyCellCollection< SCellSCells
 
typedef std::set< CellCellSet
 Preferred type for defining a set of Cell(s). More...
 
typedef std::set< SCellSCellSet
 Preferred type for defining a set of SCell(s). More...
 
typedef std::set< SCellSurfelSet
 Preferred type for defining a set of surfels (always signed cells). More...
 

Public Member Functions

Standard services
 ~KhalimskySpaceND ()
 Destructor. More...
 
 KhalimskySpaceND ()
 Default constructor. More...
 
 KhalimskySpaceND (const KhalimskySpaceND &other)=default
 Copy constructor. More...
 
KhalimskySpaceNDoperator= (const KhalimskySpaceND &other)=default
 Copy operator. More...
 
 KhalimskySpaceND (KhalimskySpaceND &&other)=default
 Move constructor. More...
 
KhalimskySpaceNDoperator= (KhalimskySpaceND &&other)=default
 Move operator. More...
 
bool init (const Point &lower, const Point &upper, bool isClosed)
 Specifies the upper and lower bounds for the maximal cells in this space. More...
 
bool init (const Point &lower, const Point &upper, Closure closure)
 Specifies the upper and lower bounds for the maximal cells in this space. More...
 
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. More...
 
Basic services
Size size (Dimension k) const
 Return the width of the space in the k-dimension. More...
 
Integer min (Dimension k) const
 Return the minimal digital coordinate in the k-dimension. More...
 
Integer max (Dimension k) const
 Return the maximal digital coordinate in the k-dimension. More...
 
const PointlowerBound () const
 Return the lower bound for digital points in this space. More...
 
const PointupperBound () const
 Return the upper bound for digital points in this space. More...
 
const CelllowerCell () const
 Return the lower bound for cells in this space. More...
 
const CellupperCell () const
 Return the upper bound for cells in this space. More...
 
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 returned by lowerCell and upperCell. More...
 
bool uIsValid (const PreCell &c) const
 Returns true if the given unsigned cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell. More...
 
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 returned by lowerCell and upperCell. More...
 
bool sIsValid (const SPreCell &c) const
 Returns true if the given signed cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell. More...
 
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 by lowerCell and upperCell. More...
 
bool cIsValid (const Point &p) const
 Returns true if the given cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell. More...
 
Closure type query
bool isSpaceClosed () const
 Return 'true' iff the space is closed or periodic along every dimension. More...
 
bool isSpaceClosed (Dimension k) const
 Return 'true' iff the space is closed or periodic along the specified dimension. More...
 
bool isSpacePeriodic () const
 Return 'true' iff the space is periodic along every dimension. More...
 
bool isSpacePeriodic (Dimension k) const
 Return 'true' iff the space is periodic along the specified dimension. More...
 
bool isAnyDimensionPeriodic () const
 Return 'true' iff the space is periodic along at least one dimension. More...
 
Closure getClosure (Dimension k) const
 Gets closure type. More...
 
Cell creation services
Cell uCell (const PreCell &c) const
 From an unsigned cell, returns an unsigned cell lying into this Khalismky space. More...
 
Cell uCell (const Point &kp) const
 From the Khalimsky coordinates of a cell, builds the corresponding unsigned cell lying into this Khalismky space. More...
 
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 lying into this Khalismky space. More...
 
SCell sCell (const SPreCell &c) const
 From a signed cell, returns a signed cell lying into this Khalismky space. More...
 
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 this Khalismky space. More...
 
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 cell lying into this Khalismky space. More...
 
Cell uSpel (Point p) const
 From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimension) lying into this Khalismky space. More...
 
SCell sSpel (Point p, Sign sign=POS) const
 From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimension) lying into this Khalismky space. More...
 
Cell uPointel (Point p) const
 From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0) lying into this Khalismky space. More...
 
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) lying into this Khalismky space. More...
 
Read accessors to cells
Integer uKCoord (const Cell &c, Dimension k) const
 Return its Khalimsky coordinate along [k]. More...
 
Integer uCoord (const Cell &c, Dimension k) const
 Return its digital coordinate along [k]. More...
 
const PointuKCoords (const Cell &c) const
 Return its Khalimsky coordinates. More...
 
Point uCoords (const Cell &c) const
 Return its digital coordinates. More...
 
Integer sKCoord (const SCell &c, Dimension k) const
 Return its Khalimsky coordinate along [k]. More...
 
Integer sCoord (const SCell &c, Dimension k) const
 Return its digital coordinate along [k]. More...
 
const PointsKCoords (const SCell &c) const
 Return its Khalimsky coordinates. More...
 
Point sCoords (const SCell &c) const
 Return its digital coordinates. More...
 
Sign sSign (const SCell &c) const
 Return its sign. More...
 
Write accessors to cells
void uSetKCoord (Cell &c, Dimension k, Integer i) const
 Sets the [k]-th Khalimsky coordinate of [c] to [i]. More...
 
void sSetKCoord (SCell &c, Dimension k, Integer i) const
 Sets the [k]-th Khalimsky coordinate of [c] to [i]. More...
 
void uSetCoord (Cell &c, Dimension k, Integer i) const
 Sets the [k]-th digital coordinate of [c] to [i]. More...
 
void sSetCoord (SCell &c, Dimension k, Integer i) const
 Sets the [k]-th digital coordinate of [c] to [i]. More...
 
void uSetKCoords (Cell &c, const Point &kp) const
 Sets the Khalimsky coordinates of [c] to [kp]. More...
 
void sSetKCoords (SCell &c, const Point &kp) const
 Sets the Khalimsky coordinates of [c] to [kp]. More...
 
void uSetCoords (Cell &c, const Point &kp) const
 Sets the digital coordinates of [c] to [kp]. More...
 
void sSetCoords (SCell &c, const Point &kp) const
 Sets the digital coordinates of [c] to [kp]. More...
 
void sSetSign (SCell &c, Sign s) const
 Sets the sign of the cell. More...
 
Conversion signed/unsigned
SCell signs (const Cell &p, Sign s) const
 Creates a signed cell from an unsigned one and a given sign. More...
 
Cell unsigns (const SCell &p) const
 Creates an unsigned cell from a signed one. More...
 
SCell sOpp (const SCell &p) const
 Creates the signed cell with the inverse sign of [p]. More...
 
Cell topology services
Integer uTopology (const Cell &p) const
 Return the topology word of [p]. More...
 
Integer sTopology (const SCell &p) const
 Return the topology word of [p]. More...
 
Dimension uDim (const Cell &p) const
 Return the dimension of the cell [p]. More...
 
Dimension sDim (const SCell &p) const
 Return the dimension of the cell [p]. More...
 
bool uIsSurfel (const Cell &b) const
 Return 'true' if [b] is a surfel (spans all but one coordinate). More...
 
bool sIsSurfel (const SCell &b) const
 Return 'true' if [b] is a surfel (spans all but one coordinate). More...
 
bool uIsOpen (const Cell &p, Dimension k) const
 Return 'true' if [p] is open along the direction [k]. More...
 
bool sIsOpen (const SCell &p, Dimension k) const
 Return 'true' if [p] is open along the direction [k]. More...
 
Iterator services for cells
DirIterator uDirs (const Cell &p) const
 Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell spans. More...
 
DirIterator sDirs (const SCell &p) const
 Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans. More...
 
DirIterator uOrthDirs (const Cell &p) const
 Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell does not span. More...
 
DirIterator sOrthDirs (const SCell &p) const
 Given a signed cell [p], returns an iterator to iterate over each coordinate the cell does not span. More...
 
Dimension uOrthDir (const Cell &s) const
 Given an unsigned surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is closed). More...
 
Dimension sOrthDir (const SCell &s) const
 Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is closed). More...
 
Unsigned cell geometry services
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]. More...
 
Cell uFirst (const PreCell &p) const
 Return the first cell of the space with the same type as [p]. More...
 
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]. More...
 
Cell uLast (const PreCell &p) const
 Return the last cell of the space with the same type as [p]. More...
 
Cell uGetIncr (const Cell &p, Dimension k) const
 Return the same element as [p] except for the incremented coordinate [k]. More...
 
bool uIsMax (const Cell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
bool uIsInside (const PreCell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
bool uIsInside (const PreCell &p) const
 Useful to check if you are going out of the space. More...
 
bool cIsInside (const Point &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
bool cIsInside (const Point &p) const
 Useful to check if you are going out of the space. More...
 
Cell uGetMax (Cell p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
Cell uGetDecr (const Cell &p, Dimension k) const
 Return the same element as [p] except for an decremented coordinate [k]. More...
 
bool uIsMin (const Cell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
Cell uGetMin (Cell p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
Cell uGetAdd (const Cell &p, Dimension k, Integer x) const
 Return the same element as [p] except for a coordinate [k] incremented with x. More...
 
Cell uGetSub (const Cell &p, Dimension k, Integer x) const
 Return the same element as [p] except for a coordinate [k] decremented with x. More...
 
Integer uDistanceToMax (const Cell &p, Dimension k) const
 Useful to check if you are going out of the space (for non-periodic dimensions). More...
 
Integer uDistanceToMin (const Cell &p, Dimension k) const
 Useful to check if you are going out of the space (for non-periodic dimensions). More...
 
Cell uTranslation (const Cell &p, const Vector &vec) const
 Add the vector [vec] to [p]. More...
 
Cell uProjection (const Cell &p, const Cell &bound, Dimension k) const
 Return the projection of [p] along the [k]th direction toward [bound]. More...
 
void uProject (Cell &p, const Cell &bound, Dimension k) const
 Projects [p] along the [k]th direction toward [bound]. More...
 
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). More...
 
Signed cell geometry services
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]. More...
 
SCell sFirst (const SPreCell &p) const
 Return the first cell of the space with the same type as [p]. More...
 
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]. More...
 
SCell sLast (const SPreCell &p) const
 Return the last cell of the space with the same type as [p]. More...
 
SCell sGetIncr (const SCell &p, Dimension k) const
 Return the same element as [p] except for the incremented coordinate [k]. More...
 
bool sIsMax (const SCell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
bool sIsInside (const SPreCell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
bool sIsInside (const SPreCell &p) const
 Useful to check if you are going out of the space. More...
 
SCell sGetMax (SCell p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
SCell sGetDecr (const SCell &p, Dimension k) const
 Return the same element as [p] except for an decremented coordinate [k]. More...
 
bool sIsMin (const SCell &p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
SCell sGetMin (SCell p, Dimension k) const
 Useful to check if you are going out of the space. More...
 
SCell sGetAdd (const SCell &p, Dimension k, Integer x) const
 Return the same element as [p] except for a coordinate [k] incremented with x. More...
 
SCell sGetSub (const SCell &p, Dimension k, Integer x) const
 Return the same element as [p] except for a coordinate [k] decremented with x. More...
 
Integer sDistanceToMax (const SCell &p, Dimension k) const
 Useful to check if you are going out of the space (for non-periodic dimensions). More...
 
Integer sDistanceToMin (const SCell &p, Dimension k) const
 Useful to check if you are going out of the space (for non-periodic dimensions). More...
 
SCell sTranslation (const SCell &p, const Vector &vec) const
 Add the vector [vec] to [p]. More...
 
SCell sProjection (const SCell &p, const SCell &bound, Dimension k) const
 Return the projection of [p] along the [k]th direction toward [bound]. More...
 
void sProject (SCell &p, const SCell &bound, Dimension k) const
 Projects [p] along the [k]th direction toward [bound]. More...
 
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). More...
 
Neighborhood services
Cells uNeighborhood (const Cell &cell) const
 Computes the 1-neighborhood of the cell [c] and returns it. More...
 
SCells sNeighborhood (const SCell &cell) const
 Computes the 1-neighborhood of the cell [c] and returns it. More...
 
Cells uProperNeighborhood (const Cell &cell) const
 Computes the proper 1-neighborhood of the cell [c] and returns it. More...
 
SCells sProperNeighborhood (const SCell &cell) const
 Computes the proper 1-neighborhood of the cell [c] and returns it. More...
 
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. More...
 
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. More...
 
Incidence services
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]. More...
 
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]. More...
 
Cells uLowerIncident (const Cell &c) const
 Return the cells directly low incident to c in this space. More...
 
Cells uUpperIncident (const Cell &c) const
 Return the cells directly up incident to c in this space. More...
 
SCells sLowerIncident (const SCell &c) const
 Return the signed cells directly low incident to c in this space. More...
 
SCells sUpperIncident (const SCell &c) const
 Return the signed cells directly up incident to c in this space. More...
 
Cells uFaces (const Cell &c) const
 Return the proper faces of [c] (chain of lower incidence) that belong to the space. More...
 
Cells uCoFaces (const Cell &c) const
 Return the proper cofaces of [c] (chain of upper incidence) that belong to the space. More...
 
bool sDirect (const SCell &p, Dimension k) const
 Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction. More...
 
SCell sDirectIncident (const SCell &p, Dimension k) const
 Return the direct incident cell of [p] along [k] (the incident cell along [k]) More...
 
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 negative). More...
 
DGtal interface
void selfDisplay (std::ostream &out) const
 Writes/Displays the object on an output stream. More...
 
bool isValid () const
 Checks the validity/consistency of the object. More...
 

Static Public Attributes

static const constexpr Dimension dimension = dim
 
static const constexpr Dimension DIM = dim
 
static const constexpr Sign POS = true
 
static const constexpr Sign NEG = false
 

Private Types

typedef KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > > Helper
 Features basic operations on coordinates, especially for periodic dimensions. More...
 

Private Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CInteger< TInteger >))
 Integer must be signed to characterize a ring. More...
 
Internals
void uAddFaces (Cells &faces, const Cell &c, Dimension axis) const
 Used by uFaces for computing incident faces. More...
 
void uAddCoFaces (Cells &cofaces, const Cell &c, Dimension axis) const
 Used by uCoFaces for computing incident cofaces. More...
 

Private Attributes

Point myLower
 
Point myUpper
 
Cell myCellLower
 
Cell myCellUpper
 
std::array< Closure, dimensionmyClosure
 

Friends

class KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > >
 

Detailed Description

template<Dimension dim, typename TInteger>
class DGtal::KhalimskySpaceND< dim, TInteger >

Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex, whose cells are defined as an array of integers. The topology of the cells is defined by the parity of the coordinates (even: closed, odd: open).

Description of template class 'KhalimskySpaceND'

When initializing the space using init(), the user should choose, for each dimension spanned by the space, between a closed and non-periodic (default) cell dimension, an open cell dimension or a periodic cell dimension. The space is generally finite, except for arbitrary size integers and when the space has a periodic dimension.

Supposing that the space has been initialized with digital bounds lower and upper, the methods lowerBound() and upperBound() will always return, respectively, lower and upper. It as also true for periodic dimension, in order to span over the unique digital points of the space.

In the same way, lowerCell() and upperCell() respect the following rules:

The special behavior for periodic dimensions guarantees that each cell has unique Khalimsky coordinates in this range. It is useful to span the space and also for cell-based containers (see e.g. CubicalComplex). Uniqueness also gives meaning to equality tests between cells.

Following this concept, the related methods size(), min(), max(), uFirst(), uLast(), uGetMin(), uGetMax(), uDistanceToMin(), uDistanceToMax(), sFirst(), sLast(), sGetMin(), sGetMax(), sDistanceToMin() and sDistanceToMax() behave for periodic dimensions like for finite dimensions, using the bounds described above.

Thus, if a cell needs to be compared to the bounds, prefer using dedicated tests like uIsMin(), uIsMax(), sIsMin() and sIsMax() that return always false for a periodic dimension, and uIsInside() and sIsInside() that return always true for a periodic dimension.

To be consistent with those choices, each cell returned or modified by a KhalimskySpaceND method will have his Khalimsky coordinates along periodic dimensions between the corresponding coordinates of lowerCell() and upperCell(). But, in order to keep low computational cost, each cell passed by parameter to a KhalimskySpaceND method must follow the same conditions. This validity can be tested with the dedicated methods uIsValid() and sIsValid().

Exceptions exist for uCell(const PreCell &) const and sCell(const SPreCell &) const that are specially featured to correct Khalimsky coordinates of a given cell. In addition, when a method accepts a coordinate as parameter, it is always corrected along periodic dimensions.

Template Parameters
dimthe dimension of the digital space.
TIntegerthe Integer class used to specify the arithmetic computations (default type = int32).
Note
Essentially a backport from ImaGene.
Warning
Periodic Khalimsky space and per-dimension closure specification are new features. Therefore, there is no guarantee that it is compatible with the whole DGtal library.
Examples
dec/exampleDECSurface.cpp, dec/exampleHeatLaplace.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleGridCurve3d-2.cpp, geometry/curves/exampleRationalConvexity.cpp, geometry/surfaces/dvcm-2d-curvature.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/volumes/distance/exampleFMM3D.cpp, graph/volDistanceTraversal.cpp, io/boards/dgtalBoard3D-2-ks.cpp, io/boards/dgtalBoard3DTo2D-KSCell.cpp, io/viewDualSurface.cpp, io/viewers/viewer3D-10-interaction.cpp, io/viewers/viewer3D-11-extension.cpp, io/viewers/viewer3D-4bis-illustrationMode.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/3dKSSurfaceExtraction.cpp, topology/area-estimation-with-digital-surface.cpp, topology/area-estimation-with-indexed-digital-surface.cpp, topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, topology/cubical-complex-collapse.cpp, topology/cubical-complex-illustrations.cpp, topology/digitalSetToCubicalComplexes2D.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/khalimskySpaceScanner.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, tutorial-examples/FMMErosion.cpp, tutorial-examples/freemanChainFromImage.cpp, and tutorial-examples/polyhedralizer.cpp.

Definition at line 64 of file KhalimskySpaceND.h.

Member Typedef Documentation

◆ AnyCellCollection

template<Dimension dim, typename TInteger >
template<typename CellType >
using DGtal::KhalimskySpaceND< dim, TInteger >::AnyCellCollection = typename PreCellularGridSpace::template AnyCellCollection< CellType >

Definition at line 436 of file KhalimskySpaceND.h.

◆ Cell

template<Dimension dim, typename TInteger >
typedef KhalimskyCell< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::Cell

Definition at line 415 of file KhalimskySpaceND.h.

◆ Cells

template<Dimension dim, typename TInteger >
typedef AnyCellCollection<Cell> DGtal::KhalimskySpaceND< dim, TInteger >::Cells

Definition at line 439 of file KhalimskySpaceND.h.

◆ CellSet

template<Dimension dim, typename TInteger >
typedef std::set<Cell> DGtal::KhalimskySpaceND< dim, TInteger >::CellSet

Preferred type for defining a set of Cell(s).

Definition at line 444 of file KhalimskySpaceND.h.

◆ CellularGridSpace

template<Dimension dim, typename TInteger >
typedef KhalimskySpaceND<dim, Integer> DGtal::KhalimskySpaceND< dim, TInteger >::CellularGridSpace

Definition at line 411 of file KhalimskySpaceND.h.

◆ DirIterator

template<Dimension dim, typename TInteger >
using DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator = typename PreCellularGridSpace::DirIterator

Definition at line 422 of file KhalimskySpaceND.h.

◆ Helper

template<Dimension dim, typename TInteger >
typedef KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > > DGtal::KhalimskySpaceND< dim, TInteger >::Helper
private

Features basic operations on coordinates, especially for periodic dimensions.

Definition at line 396 of file KhalimskySpaceND.h.

◆ Integer

template<Dimension dim, typename TInteger >
typedef TInteger DGtal::KhalimskySpaceND< dim, TInteger >::Integer

Arithmetic ring induced by (+,-,*) and Integer numbers.

Definition at line 404 of file KhalimskySpaceND.h.

◆ Point

template<Dimension dim, typename TInteger >
typedef PointVector< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::Point

Definition at line 425 of file KhalimskySpaceND.h.

◆ PreCell

template<Dimension dim, typename TInteger >
typedef KhalimskyPreCell< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::PreCell

Definition at line 416 of file KhalimskySpaceND.h.

◆ PreCellularGridSpace

template<Dimension dim, typename TInteger >
typedef KhalimskyPreSpaceND<dim, Integer> DGtal::KhalimskySpaceND< dim, TInteger >::PreCellularGridSpace

Definition at line 412 of file KhalimskySpaceND.h.

◆ SCell

template<Dimension dim, typename TInteger >
typedef SignedKhalimskyCell< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::SCell

Definition at line 417 of file KhalimskySpaceND.h.

◆ SCells

template<Dimension dim, typename TInteger >
typedef AnyCellCollection<SCell> DGtal::KhalimskySpaceND< dim, TInteger >::SCells

Definition at line 440 of file KhalimskySpaceND.h.

◆ SCellSet

template<Dimension dim, typename TInteger >
typedef std::set<SCell> DGtal::KhalimskySpaceND< dim, TInteger >::SCellSet

Preferred type for defining a set of SCell(s).

Definition at line 447 of file KhalimskySpaceND.h.

◆ Sign

template<Dimension dim, typename TInteger >
typedef bool DGtal::KhalimskySpaceND< dim, TInteger >::Sign

Definition at line 421 of file KhalimskySpaceND.h.

◆ Size

template<Dimension dim, typename TInteger >
typedef NumberTraits<Integer>::UnsignedVersion DGtal::KhalimskySpaceND< dim, TInteger >::Size

Type used to represent sizes in the digital space.

Definition at line 407 of file KhalimskySpaceND.h.

◆ Space

template<Dimension dim, typename TInteger >
typedef SpaceND<dim, Integer> DGtal::KhalimskySpaceND< dim, TInteger >::Space

Definition at line 410 of file KhalimskySpaceND.h.

◆ SPreCell

template<Dimension dim, typename TInteger >
typedef SignedKhalimskyPreCell< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::SPreCell

Definition at line 418 of file KhalimskySpaceND.h.

◆ Surfel

template<Dimension dim, typename TInteger >
typedef SCell DGtal::KhalimskySpaceND< dim, TInteger >::Surfel

Definition at line 420 of file KhalimskySpaceND.h.

◆ SurfelSet

template<Dimension dim, typename TInteger >
typedef std::set<SCell> DGtal::KhalimskySpaceND< dim, TInteger >::SurfelSet

Preferred type for defining a set of surfels (always signed cells).

Definition at line 450 of file KhalimskySpaceND.h.

◆ Vector

template<Dimension dim, typename TInteger >
typedef PointVector< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::Vector

Definition at line 426 of file KhalimskySpaceND.h.

Member Enumeration Documentation

◆ Closure

template<Dimension dim, typename TInteger >
enum DGtal::KhalimskySpaceND::Closure

Boundaries closure type.

Enumerator
CLOSED 

The dimension is closed and non-periodic.

OPEN 

The dimension is open.

PERIODIC 

The dimension is periodic.

Definition at line 471 of file KhalimskySpaceND.h.

472  {
473  CLOSED,
474  OPEN,
475  PERIODIC
476  };

Constructor & Destructor Documentation

◆ ~KhalimskySpaceND()

template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::~KhalimskySpaceND ( )

Destructor.

◆ KhalimskySpaceND() [1/3]

template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::KhalimskySpaceND ( )

Default constructor.

◆ KhalimskySpaceND() [2/3]

template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::KhalimskySpaceND ( const KhalimskySpaceND< dim, TInteger > &  other)
default

Copy constructor.

Parameters
otherthe object to clone.

◆ KhalimskySpaceND() [3/3]

template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::KhalimskySpaceND ( KhalimskySpaceND< dim, TInteger > &&  other)
default

Move constructor.

Parameters
otherthe object to clone.

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::BOOST_CONCEPT_ASSERT ( (concepts::CInteger< TInteger >)  )
private

Integer must be signed to characterize a ring.

◆ cIsInside() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::cIsInside ( const Point p) const

Useful to check if you are going out of the space.

Parameters
pany integer point (Khalimsky coordinates).
Returns
true if [p] has its coordinates within the allowed bounds.
Note
Only the non-periodic dimensions are checked.

◆ cIsInside() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::cIsInside ( const Point p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany integer point (Khalimsky coordinates).
kthe tested coordinate.
Returns
true if [p] has its [k]-coordinate within the allowed bounds.
Note
It returns always true for periodic dimension.

◆ cIsValid() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::cIsValid ( const Point p) const

Returns true if the given cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.

Parameters
pan integer point (Khalimsky coordinates of cell).
Returns
true if the given cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.

◆ cIsValid() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::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 by lowerCell and upperCell.

Parameters
pan integer point (Khalimsky coordinates of cell).
ka dimension.
Returns
true if the given cell has his k-th Khalimsky coordinate between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.

◆ getClosure()

template<Dimension dim, typename TInteger >
Closure DGtal::KhalimskySpaceND< dim, TInteger >::getClosure ( Dimension  k) const

Gets closure type.

Parameters
kthe dimension.
Returns
closure type along the specified dimension.

◆ init() [1/3]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::init ( const Point lower,
const Point upper,
bool  isClosed 
)

Specifies the upper and lower bounds for the maximal cells in this space.

Parameters
lowerthe lowest point in this space (digital coords)
upperthe upper point in this space (digital coords)
isClosed'true' if this space is closed and non-periodic in every dimension, 'false' if open.
Returns
true if the initialization was valid (ie, such bounds are representable with these integers).
Examples
dec/exampleDECSurface.cpp, dec/exampleHeatLaplace.cpp, examples/tutorial-examples/polyhedralizer.cpp, geometry/curves/estimation/exampleCurvature.cpp, geometry/curves/exampleGridCurve2d.cpp, geometry/curves/exampleGridCurve3d.cpp, geometry/surfaces/dvcm-2d-curvature.cpp, geometry/surfaces/dvcm-3d.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, geometry/tools/exampleAlphaShape.cpp, geometry/volumes/distance/exampleFMM3D.cpp, graph/volDistanceTraversal.cpp, io/boards/dgtalBoard3D-2-ks.cpp, io/boards/dgtalBoard3DTo2D-KSCell.cpp, io/viewDualSurface.cpp, io/viewers/viewer3D-10-interaction.cpp, io/viewers/viewer3D-11-extension.cpp, io/viewers/viewer3D-4bis-illustrationMode.cpp, shapes/viewMarchingCubes.cpp, shapes/viewPolygonalMarchingCubes.cpp, topology/3dKSSurfaceExtraction.cpp, topology/area-estimation-with-digital-surface.cpp, topology/area-estimation-with-indexed-digital-surface.cpp, topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, topology/cubical-complex-collapse.cpp, topology/cubical-complex-illustrations.cpp, topology/digitalSetToCubicalComplexes2D.cpp, topology/digitalSurfaceSlice.cpp, topology/frontierAndBoundary.cpp, topology/khalimskySpaceScanner.cpp, topology/trackImplicitPolynomialSurfaceToOFF.cpp, topology/volBreadthFirstTraversal.cpp, topology/volMarchingCubes.cpp, topology/volScanBoundary.cpp, topology/volToOFF.cpp, topology/volTrackBoundary.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, tutorial-examples/FMMErosion.cpp, tutorial-examples/freemanChainFromImage.cpp, and tutorial-examples/polyhedralizer.cpp.

Referenced by accuracyTest(), alphaShape(), ballGenerator(), digitize(), estimatorOnShapeDigitization(), DGtal::functions::generateVoxelComplexTable(), getComplex(), DGtal::Shortcuts< TKSpace >::getKSpace(), laplace_sphere(), laplacian(), main(), Object3D(), SCENARIO(), test3dSurfaceHelper(), TEST_CASE(), testBallQuad(), testCombinatorialSurface(), testCompareEstimator(), testComputeInterior(), testCube(), testCurvature2d(), testDigitalSetBoundary(), testDigitalSurface(), testDigitalSurfaceBoostGraphInterface(), testDigitization(), testEmbedder(), testEstimatorCache(), testExplicitDigitalSurface(), testFindABel(), testFitting(), testGaussianCurvature3d(), testImplicitDigitalSurface(), testLightExplicitDigitalSurface(), testLightImplicitDigitalSurface(), testLocalConvolutionNormalVectorEstimator(), testLocalEstimatorFromFunctorAdapter(), testMeanCurvature3d(), testNormaliation(), testObjectGraph(), testOrderingDigitalSurfaceFacesAroundVertex(), testPrincipalCurvatures3d(), testQuadNorm(), testRaySurface(), testRaySurfelIntersection(), testTrueLocalEstimatorOnShapeDigitization(), and testUmbrellaComputer().

◆ init() [2/3]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::init ( const Point lower,
const Point upper,
Closure  closure 
)

Specifies the upper and lower bounds for the maximal cells in this space.

Parameters
lowerthe lowest point in this space (digital coords)
upperthe upper point in this space (digital coords)
closureCLOSED, OPEN or PERIODIC if this space is resp. closed (and non-periodic), open or periodic in every dimension.
Returns
true if the initialization was valid (ie, such bounds are representable with these integers).

◆ init() [3/3]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::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.

Parameters
lowerthe lowest point in this space (digital coords)
upperthe upper point in this space (digital coords)
closurean array of CLOSED, OPEN or PERIODIC if this space is resp. closed (and non-periodic), open or periodic in the corresponding dimension.
Returns
true if the initialization was valid (ie, such bounds are representable with these integers).

◆ isAnyDimensionPeriodic()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isAnyDimensionPeriodic ( ) const

Return 'true' iff the space is periodic along at least one dimension.

Returns
'true' iff the space is periodic along at least one dimension.

◆ isSpaceClosed() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isSpaceClosed ( ) const

Return 'true' iff the space is closed or periodic along every dimension.

Returns
'true' iff the space is closed or periodic along every dimension.

◆ isSpaceClosed() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isSpaceClosed ( Dimension  k) const

Return 'true' iff the space is closed or periodic along the specified dimension.

Parameters
kthe dimension.
Returns
'true' iff the space is closed or periodic along the specified dimension.

◆ isSpacePeriodic() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isSpacePeriodic ( ) const

Return 'true' iff the space is periodic along every dimension.

Returns
'true' iff the space is periodic along every dimension.

◆ isSpacePeriodic() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isSpacePeriodic ( Dimension  k) const

Return 'true' iff the space is periodic along the specified dimension.

Parameters
kthe dimension.
Returns
'true' iff the space is periodic along the specified dimension.

◆ isValid()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isValid ( ) const

Checks the validity/consistency of the object.

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

◆ lowerBound()

template<Dimension dim, typename TInteger >
const Point& DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound ( ) const

Return the lower bound for digital points in this space.

Returns
the lower bound for digital points in this space.
Note
For periodic dimension, it returns the lower digital point with unique coordinates. See also the class documentation.
Examples
geometry/curves/exampleGridCurve3d-2.cpp, topology/ctopo-2.cpp, topology/ctopo-fillContours.cpp, topology/digitalSurfaceSlice.cpp, and topology/volToOFF.cpp.

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurfaces(), and TEST_CASE_METHOD().

◆ lowerCell()

template<Dimension dim, typename TInteger >
const Cell& DGtal::KhalimskySpaceND< dim, TInteger >::lowerCell ( ) const

Return the lower bound for cells in this space.

Returns
the lower bound for cells in this space.
Note
For periodic dimension, it returns the upper cell with unique coordinates. See also the class documentation.
Examples
topology/ctopo-fillContours.cpp.

Referenced by main().

◆ max()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::max ( Dimension  k) const

Return the maximal digital coordinate in the k-dimension.

Parameters
ka coordinate.
Returns
the maximal digital coordinate in the k-dimension.
Note
For periodic dimension, it returns the maximal unique digital coordinate along that dimension.

◆ min()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::min ( Dimension  k) const

Return the minimal digital coordinate in the k-dimension.

Parameters
ka dimension.
Returns
the minimal digital coordinate in the k-dimension.
Note
For periodic dimension, it returns the minimal unique digital coordinate along that dimension.

◆ operator=() [1/2]

template<Dimension dim, typename TInteger >
KhalimskySpaceND& DGtal::KhalimskySpaceND< dim, TInteger >::operator= ( const KhalimskySpaceND< dim, TInteger > &  other)
default

Copy operator.

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

◆ operator=() [2/2]

template<Dimension dim, typename TInteger >
KhalimskySpaceND& DGtal::KhalimskySpaceND< dim, TInteger >::operator= ( KhalimskySpaceND< dim, TInteger > &&  other)
default

Move operator.

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

◆ sAdjacent()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sAdjacent ( const SCell p,
Dimension  k,
bool  up 
) const

Return the adjacent element to [p] along axis [k] in the given direction and orientation.

Parameters
pany cell.
kthe coordinate that is changed.
upif 'true' the orientation is forward along axis [k], otherwise backward.
Returns
the adjacent element to [p] along axis [k] in the given direction and orientation.
Note
It is an alias to 'up ? sGetIncr( p, k ) : sGetDecr( p, k )'.
Precondition
sIsValid(p) and not sIs(Min|Max)(p, k) depending on up value.
Postcondition
`sIsValid(sAdjacent(p, k, up)) is true.

◆ sCell() [1/3]

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::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 this Khalismky space.

Along a non-periodic dimension, if the given Khalimsky coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the Khalimsky coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
kpan integer point (Khalimsky coordinates of cell).
signthe sign of the cell (either POS or NEG).
Returns
the signed cell.
Postcondition
sIsValid(sCell(kp, sign)) is true.

◆ sCell() [2/3]

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sCell ( const SPreCell c) const

From a signed cell, returns a signed cell lying into this Khalismky space.

Along a non-periodic dimension, if the given Khalimsky coordinate lies outside the space, it replaces it by the nearest valid coordinate.

Along a periodic dimension, the Khalimsky coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
ca signed cell.
Returns
the same signed cell with appropriate Khalimsky coordinates along periodic dimensions.
Postcondition
sIsValid(sCell(c)) is true.
sCell(c) == c if sIsValid(c).
Examples
io/boards/dgtalBoard3DTo2D-KSCell.cpp, io/viewers/viewer3D-10-interaction.cpp, and topology/ctopo-1s-3d.cpp.

Referenced by cmpSCellsIfInside(), digitize(), main(), DGtal::Shortcuts< TKSpace >::SCellReader::operator()(), testCellDrawOnBoard(), testFaces(), testFindABel(), testNeighborhood(), testRaySurfelIntersection(), testScan(), and testSurfelAdjacency().

◆ sCell() [3/3]

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::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 cell lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
canother cell defining the topology and sign.
Returns
the cell having the topology and sign of [c] and the given digital coordinates [p].
Postcondition
sIsValid(sCell(p, c)) is true.

◆ sCoord()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::sCoord ( const SCell c,
Dimension  k 
) const

Return its digital coordinate along [k].

Parameters
cany signed cell.
kany valid dimension.
Returns
its digital coordinate along [k].
Precondition
uIsValid(c) is true.

◆ sCoords()

template<Dimension dim, typename TInteger >
Point DGtal::KhalimskySpaceND< dim, TInteger >::sCoords ( const SCell c) const

◆ sDim()

template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::sDim ( const SCell p) const

Return the dimension of the cell [p].

Parameters
pany signed cell.
Returns
the dimension of the cell [p].

Referenced by DGtal::functors::SCellToPoint< KSpace >::operator()(), SCENARIO(), and testFindABel().

◆ sDirect()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sDirect ( const SCell p,
Dimension  k 
) const

Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.

The direct orientation in a direction allows to go from positive incident cells to positive incident cells. This means that

K.sSign( K.sIncident( p, k, K.sDirect( p, k ) ) ) == K.POS

is always true.

Parameters
pany signed cell.
kany coordinate.
Returns
the direct orientation of [p] along [k] (true is upward, false is backward).
Examples
topology/area-estimation-with-digital-surface.cpp, and topology/area-estimation-with-indexed-digital-surface.cpp.

Referenced by DGtal::Shortcuts< TKSpace >::getPrimalVertices(), DGtal::ShortcutsGeometry< TKSpace >::getTrivialNormalVectors(), main(), testCellDrawOnBoard(), testDirectIncidence(), and testSurfelAdjacency().

◆ sDirectIncident()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sDirectIncident ( const SCell p,
Dimension  k 
) const

Return the direct incident cell of [p] along [k] (the incident cell along [k])

Parameters
pany signed cell.
kany coordinate.
Returns
the direct incident cell of [p] along [k] (the incident cell along [k])
Precondition
sIsValid(p) and the cell should have a direct incident cell in this direction.
Postcondition
sIsValid(c) is true for every returned cell c. ose sign is positive).
Examples
examples/tutorial-examples/polyhedralizer.cpp, geometry/surfaces/greedy-plane-segmentation-ex2.cpp, geometry/surfaces/greedy-plane-segmentation.cpp, tutorial-examples/AreaSurfaceEstimation-final.cpp, and tutorial-examples/polyhedralizer.cpp.

Referenced by main(), DGtal::functors::SCellToInnerPoint< KSpace >::operator()(), DGtal::functors::SCellToIncidentPoints< KSpace >::operator()(), testDirectIncidence(), testFindABel(), and testSurfelAdjacency().

◆ sDirs()

template<Dimension dim, typename TInteger >
DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::sDirs ( const SCell p) const

Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.

(A spel spans all coordinates; a surfel all but one, etc).

Example:

...
for ( KSpace::DirIterator q = ks.uDirs( p ); q != 0; ++q )
{
Dimension dir = *q;
...
}
Parameters
pany signed cell.
Returns
an iterator that points on the first coordinate spanned by the cell.
Examples
geometry/curves/exampleGridCurve3d-2.cpp, topology/ctopo-2-3d.cpp, and topology/digitalSurfaceSlice.cpp.

Referenced by main(), DGtal::functors::SCellToPoint< KSpace >::operator()(), DGtal::functors::SCellToArrow< KSpace >::operator()(), DGtal::functors::SCellToCode< KSpace >::operator()(), testDigitalSetBoundary(), testDirectIncidence(), testImplicitDigitalSurface(), testIncidence(), testLightImplicitDigitalSurface(), and testUmbrellaComputer().

◆ sDistanceToMax()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::sDistanceToMax ( const SCell p,
Dimension  k 
) const

Useful to check if you are going out of the space (for non-periodic dimensions).

Parameters
pany cell.
kthe coordinate that is tested.
Returns
the number of increment to do to reach the maximum value.
Precondition
sIsValid(p) is true.

◆ sDistanceToMin()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::sDistanceToMin ( const SCell p,
Dimension  k 
) const

Useful to check if you are going out of the space (for non-periodic dimensions).

Parameters
pany cell.
kthe coordinate that is tested.
Returns
the number of decrement to do to reach the minimum value.
Precondition
sIsValid(p) is true.

◆ selfDisplay()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ sFirst() [1/2]

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sFirst ( const SPreCell p) const

Return the first cell of the space with the same type as [p].

Returns
the first cell of the space with the same type as [p].
Note
Along periodic dimensions, it returns the first unique coordinate of a cell of same type as p.
Postcondition
sIsValid(sFirst(p)) is true.

◆ sFirst() [2/2]

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::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].

Returns
the k-th coordinate of the first cell of the space with the same type as [p].
Note
For periodic dimension, it returns the first unique coordinate of a cell of same type as p.
Postcondition
The returned coordinate is between lowerCell()[k] and upperCell()[k].

◆ sGetAdd()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetAdd ( const SCell p,
Dimension  k,
Integer  x 
) const

Return the same element as [p] except for a coordinate [k] incremented with x.

Parameters
pany cell.
kthe coordinate that is changed.
xthe increment.
Returns
the same element as [p] except for a coordinate [k] incremented with x.
Precondition
sIsValid(p) and ( x <= sDistanceToMax(p, k) or isSpacePeriodic(k) ).
Postcondition
sIsValid(sGetAdd(p, k, x)) is true.

◆ sGetDecr()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetDecr ( const SCell p,
Dimension  k 
) const

Return the same element as [p] except for an decremented coordinate [k].

Parameters
pany cell.
kthe coordinate that is changed.
Returns
the same element as [p] except for an decremented coordinate [k].
Precondition
sIsValid(p) and not sIsMin(p).
Postcondition
sIsValid(sGetDecr(p, k)) is true.

◆ sGetIncr()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetIncr ( const SCell p,
Dimension  k 
) const

Return the same element as [p] except for the incremented coordinate [k].

Parameters
pany cell.
kthe coordinate that is changed.
Returns
the same element as [p] except for the incremented coordinate [k].
Precondition
sIsValid(p) and not sIsMax(p).
Postcondition
sIsValid(sGetIncr(p, k)) is true.

◆ sGetMax()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetMax ( SCell  p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe concerned coordinate.
Returns
the cell similar to [p] but with the maximum allowed [k]-coordinate.
Precondition
sIsValid(p, d) is true for each dimension d different than k.
Postcondition
sIsValid(sGetMax(p, k)) is true.

◆ sGetMin()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetMin ( SCell  p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe concerned coordinate.
Returns
the cell similar to [p] but with the minimum allowed [k]-coordinate.
Precondition
sIsValid(p, d) is true for each dimension d different than k.
Postcondition
sIsValid(sGetMin(p, k)) is true.

◆ sGetSub()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetSub ( const SCell p,
Dimension  k,
Integer  x 
) const

Return the same element as [p] except for a coordinate [k] decremented with x.

Parameters
pany cell.
kthe coordinate that is changed.
xthe decrement.
Returns
the same element as [p] except for a coordinate [k] decremented with x.
Precondition
suIsValid(p)and (x <= sDistanceToMin(p, k)orisSpacePeriodic(k)). @postsIsValid(sGetSub(p, k, x))` is true.

◆ signs()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::signs ( const Cell p,
Sign  s 
) const

Creates a signed cell from an unsigned one and a given sign.

Parameters
pany unsigned cell.
sa sign.
Returns
the signed version of the cell [p] with sign [s].
Precondition
uIsValid(p) is true.
Postcondition
sIsValid(signs(p, s)) is true.

◆ sIncident()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::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].

Parameters
cany signed cell.
kany coordinate.
upif 'true' the orientation is forward along axis [k], otherwise backward.
Returns
the forward or backward signed cell incident to [c] along axis [k], depending on [up]. It is worthy to note that the forward and backward cell have opposite sign. Furthermore, the sign of these cells is defined so as to satisfy a boundary operator.
Note
It may be a lower incident cell if [c] is open along axis [k], else an upper incident cell.
Precondition
sIsValid(c) and the cell should have an incident cell in this direction/orientation.
Postcondition
sIsValid(sIncident(c, k, up)) is true.
Examples
io/boards/dgtalBoard3D-2-ks.cpp, io/viewers/viewer3D-4bis-illustrationMode.cpp, and topology/frontierAndBoundary.cpp.

Referenced by main(), testCellDrawOnBoard(), testDirectIncidence(), testExplicitDigitalSurface(), testIncidence(), testLightExplicitDigitalSurface(), and testSurfelAdjacency().

◆ sIndirectIncident()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sIndirectIncident ( const SCell p,
Dimension  k 
) const

Return the indirect incident cell of [p] along [k] (the incident cell along [k] whose sign is negative).

Parameters
pany signed cell.
kany coordinate.
Returns
the indirect incident cell of [p] along [k] (the incident cell along [k] whose sign is negative).
Precondition
sIsValid(p) and the cell should have an indirect incident cell in this direction.
Postcondition
sIsValid(c) is true for every returned cell c. ose sign is positive).

Referenced by main(), DGtal::functors::SCellToPoint< KSpace >::operator()(), DGtal::functors::SCellToArrow< KSpace >::operator()(), DGtal::functors::SCellToOuterPoint< KSpace >::operator()(), DGtal::functors::SCellToIncidentPoints< KSpace >::operator()(), DGtal::functors::SCellToCode< KSpace >::operator()(), and testFindABel().

◆ sIsInside() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsInside ( const SPreCell p) const

Useful to check if you are going out of the space.

Parameters
pany cell.
Returns
true if [p] has its coordinates within the allowed bounds.
Note
Only the non-periodic dimensions are checked.

◆ sIsInside() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsInside ( const SPreCell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] has its [k]-coordinate within the allowed bounds.
Note
It returns always true for periodic dimension.

Referenced by cmpSCellsIfInside().

◆ sIsMax()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsMax ( const SCell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] cannot have its [k]-coordinate augmented without leaving the space.
Note
It returns always false for periodic dimension.
Precondition
sIsInside(p) is true.

◆ sIsMin()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsMin ( const SCell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] cannot have its [k]-coordinate decreased without leaving the space.
Note
It returns always false for periodic dimension.
Precondition
sIsInside(p) is true.

◆ sIsOpen()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsOpen ( const SCell p,
Dimension  k 
) const

Return 'true' if [p] is open along the direction [k].

Parameters
pany signed cell.
kany direction.
Returns
'true' if [p] is open along the direction [k].

◆ sIsSurfel()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsSurfel ( const SCell b) const

Return 'true' if [b] is a surfel (spans all but one coordinate).

Parameters
bany signed cell.
Returns
'true' if [b] is a surfel (spans all but one coordinate).

◆ sIsValid() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsValid ( const SPreCell c) const

Returns true if the given signed cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.

Parameters
ca signed cell.
Returns
true if the given signed cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.
See also
sCell(const SCell &) const to correct Khalimsky coordinates along periodic dimensions.

◆ sIsValid() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsValid ( const SPreCell c,
Dimension  k 
) const

Returns true if the given signed cell his k-th Khalimsky coordinate between those of the cells returned by lowerCell and upperCell.

Parameters
ca signed cell.
ka dimension.
Returns
true if the given signed cell his k-th Khalimsky coordinate between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.
See also
sCell(const SCell &) const to correct Khalimsky coordinates along periodic dimensions.

◆ size()

template<Dimension dim, typename TInteger >
Size DGtal::KhalimskySpaceND< dim, TInteger >::size ( Dimension  k) const

Return the width of the space in the k-dimension.

Parameters
ka dimension.
Returns
the width of the space in the k-dimension.
Note
For periodic dimension, it returns the number of unique coordinates along that dimension.

◆ sKCoord()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::sKCoord ( const SCell c,
Dimension  k 
) const

Return its Khalimsky coordinate along [k].

Parameters
cany signed cell.
kany valid dimension.
Returns
its Khalimsky coordinate along [k].
Precondition
uIsValid(c) is true.

Referenced by DGtal::Shortcuts< TKSpace >::CellWriter::operator()(), and testDigitalSurfaceBoostGraphInterface().

◆ sKCoords()

template<Dimension dim, typename TInteger >
const Point& DGtal::KhalimskySpaceND< dim, TInteger >::sKCoords ( const SCell c) const

◆ sLast() [1/2]

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sLast ( const SPreCell p) const

Return the last cell of the space with the same type as [p].

Returns
the last cell of the space with the same type as [p].
Note
Along periodic dimensions, it returns the last unique coordinate of a cell of same type as p.
Postcondition
sIsValid(sLast(p)) is true.

◆ sLast() [2/2]

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::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].

Returns
the k-th Khalimsky coordinate of the last cell of the space with the same type as [p].
Note
For periodic dimension, it returns the last unique coordinate of a cell of same type as p.
Postcondition
The returned coordinate is between lowerCell()[k] and upperCell()[k].

◆ sLowerIncident()

template<Dimension dim, typename TInteger >
SCells DGtal::KhalimskySpaceND< dim, TInteger >::sLowerIncident ( const SCell c) const

Return the signed cells directly low incident to c in this space.

Parameters
cany signed cell.
Returns
the signed cells directly low incident to c in this space.
Note
it is the lower boundary of c expressed as a list of signed cells.
Precondition
sIsValid(c) is true.
Postcondition
sIsValid(b) is true for every returned cell b.

◆ sNeighborhood()

template<Dimension dim, typename TInteger >
SCells DGtal::KhalimskySpaceND< dim, TInteger >::sNeighborhood ( const SCell cell) const

Computes the 1-neighborhood of the cell [c] and returns it.

It is the set of cells with same topology that are adjacent to [c] and which are within the bounds of this space.

Parameters
cellthe signed cell of interest.
Returns
the cells of the 1-neighborhood of [cell].
Precondition
sIsValid(cell) is true.
Postcondition
sIsValid(c) is true for every returned cell c.

Referenced by testNeighborhood().

◆ sNext()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sNext ( SCell p,
const SCell lower,
const SCell upper 
) const

Increment the cell [p] to its next position (as classically done in a scanning).

Example:

Cell first, last; // lower and upper bounds
Cell p = first;
do
{ // ... whatever [p] is the current cell
}
while ( K.uNext( p, first, last ) );
Parameters
pany cell.
lowerthe lower bound.
upperthe upper bound.
Returns
true if p is still within the bounds, false if the scanning is finished.
Precondition
sIsValid(p) and sIsValid(lower) and sIsValid(upper) and sTopology(p) == sTopology(lower) == sTopology(upper).
Postcondition
sIsValid(p) is true.

Referenced by testScan().

◆ sOpp()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sOpp ( const SCell p) const

Creates the signed cell with the inverse sign of [p].

Parameters
pany signed cell.
Returns
the cell [p] with opposite sign.
Precondition
sIsValid(p) is true.
Postcondition
sIsValid(sOpp(p)) is true.

Referenced by SCENARIO(), and testIncidence().

◆ sOrthDir()

template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDir ( const SCell s) const

◆ sOrthDirs()

template<Dimension dim, typename TInteger >
DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDirs ( const SCell p) const

Given a signed cell [p], returns an iterator to iterate over each coordinate the cell does not span.

(A spel spans all coordinates; a surfel all but one, etc).

Example:

...
for ( KSpace::DirIterator q = ks.uOrthDirs( p ); q != 0; ++q )
{
Dimension dir = *q;
...
}
Parameters
pany signed cell.
Returns
an iterator that points on the first coordinate spanned by the cell.

Referenced by main(), DGtal::functors::SCellToInnerPoint< KSpace >::operator()(), DGtal::functors::SCellToOuterPoint< KSpace >::operator()(), and DGtal::functors::SCellToIncidentPoints< KSpace >::operator()().

◆ sPointel()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sPointel ( Point  p,
Sign  sign = POS 
) const

From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0) lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
signthe sign of the cell (either POS or NEG).
Returns
the signed pointel having the given digital coordinates [p].
Postcondition
uIsValid(uSpel(p)) is true.
Examples
topology/ctopo-1s-3d.cpp.

Referenced by main().

◆ sProject()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sProject ( SCell p,
const SCell bound,
Dimension  k 
) const

Projects [p] along the [k]th direction toward [bound].

Otherwise said, p[ k ] == bound[ k ] afterwards.

Parameters
pany cell.
boundthe element acting as bound (same topology as p).
kthe concerned coordinate.
Precondition
sIsValid(p) and sIsValid(bound) and sIsOpen(p, k) == sIsOpen(bound, k)
Postcondition
sIsValid(p).

◆ sProjection()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sProjection ( const SCell p,
const SCell bound,
Dimension  k 
) const

Return the projection of [p] along the [k]th direction toward [bound].

Otherwise said, p[ k ] == bound[ k ] afterwards.

Parameters
pany cell.
boundthe element acting as bound (same topology as p).
kthe concerned coordinate.
Returns
the projection.
Precondition
sIsValid(p) and sIsValid(bound) and sIsOpen(p, k) == sIsOpen(bound, k)
Postcondition
sIsValid(sProjection(p, bound, k)) and sTopology(p) == sTopology(sProjection(p, bound, k)).

◆ sProperNeighborhood()

template<Dimension dim, typename TInteger >
SCells DGtal::KhalimskySpaceND< dim, TInteger >::sProperNeighborhood ( const SCell cell) const

Computes the proper 1-neighborhood of the cell [c] and returns it.

It is the set of cells with same topology that are adjacent to [c], different from [c] and which are within the bounds of this space.

Parameters
cellthe signed cell of interest.
Returns
the cells of the proper 1-neighborhood of [cell].
Precondition
sIsValid(cell) is true.
Postcondition
sIsValid(c) is true for every returned cell c.

Referenced by testNeighborhood().

◆ sSetCoord()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetCoord ( SCell c,
Dimension  k,
Integer  i 
) const

Sets the [k]-th digital coordinate of [c] to [i].

Parameters
cany signed cell.
kany valid dimension.
ian integer coordinate within the space.
Note
The coordinate i will be corrected if k is a periodic dimension.
Precondition
sIsValid(c) is true and i is within the space bounds if k is a non-periodic dimension.
Postcondition
sIsValid(c) is true.

◆ sSetCoords()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetCoords ( SCell c,
const Point kp 
) const

Sets the digital coordinates of [c] to [kp].

Parameters
cany signed cell.
kpthe new Khalimsky coordinates for [c].
Note
The coordinates kp will be corrected for periodic dimensions.
Precondition
kp is within the space bounds for non-periodic dimensions.
Postcondition
sIsValid(c) is true.

◆ sSetKCoord()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetKCoord ( SCell c,
Dimension  k,
Integer  i 
) const

Sets the [k]-th Khalimsky coordinate of [c] to [i].

Parameters
cany signed cell.
kany valid dimension.
ian integer coordinate within the space.
Note
The coordinate i will be corrected if k is a periodic dimension.
Precondition
sIsValid(c) is true and i is within the space bounds if k is a non-periodic dimension.
Postcondition
sIsValid(c) is true.

◆ sSetKCoords()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetKCoords ( SCell c,
const Point kp 
) const

Sets the Khalimsky coordinates of [c] to [kp].

Parameters
cany signed cell.
kpthe new Khalimsky coordinates for [c].
Note
The coordinates kp will be corrected for periodic dimensions.
Precondition
kp is within the space bounds for non-periodic dimensions.
Postcondition
sIsValid(c) is true.

◆ sSetSign()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetSign ( SCell c,
Sign  s 
) const

Sets the sign of the cell.

Parameters
c(modified) any signed cell.
sany sign.

◆ sSign()

template<Dimension dim, typename TInteger >
Sign DGtal::KhalimskySpaceND< dim, TInteger >::sSign ( const SCell c) const

Return its sign.

Parameters
cany signed cell.
Returns
its sign.
Precondition
uIsValid(c) is true.

Referenced by DGtal::Shortcuts< TKSpace >::SCellWriter::operator()(), and testDirectIncidence().

◆ sSpel()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sSpel ( Point  p,
Sign  sign = POS 
) const

From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimension) lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
signthe sign of the cell (either POS or NEG).
Returns
the signed spel having the given digital coordinates [p].
Postcondition
sIsValid(sSpel(p, sign)) is true.
Examples
io/boards/dgtalBoard3D-2-ks.cpp, io/viewers/viewer3D-4bis-illustrationMode.cpp, and topology/frontierAndBoundary.cpp.

Referenced by main(), testDirectIncidence(), testExplicitDigitalSurface(), testIncidence(), and testLightExplicitDigitalSurface().

◆ sTopology()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::sTopology ( const SCell p) const

Return the topology word of [p].

Parameters
pany signed cell.
Returns
the topology word of [p].

Referenced by testFaces(), testNeighborhood(), and testScan().

◆ sTranslation()

template<Dimension dim, typename TInteger >
SCell DGtal::KhalimskySpaceND< dim, TInteger >::sTranslation ( const SCell p,
const Vector vec 
) const

Add the vector [vec] to [p].

Parameters
pany cell.
vecany pointel.
Returns
the signed code of the cell [p] translated by [coord].
Precondition
sIsValid(p, k) and ( sDistanceToMin(p, k) <= vec[k] <= sDistanceToMax(p, k) or isPeriodicSpace(k) ) for each dimension k.
Postcondition
sIsValid(sTranslation(p, vec)) is true.
Examples
topology/ctopo-1s-3d.cpp.

Referenced by main().

◆ sUpperIncident()

template<Dimension dim, typename TInteger >
SCells DGtal::KhalimskySpaceND< dim, TInteger >::sUpperIncident ( const SCell c) const

Return the signed cells directly up incident to c in this space.

Parameters
cany signed cell.
Returns
the signed cells directly up incident to c in this space.
Note
it is the upper boundary of c expressed as a list of signed cells.
Precondition
sIsValid(c) is true.
Postcondition
sIsValid(b) is true for every returned cell b.

◆ uAddCoFaces()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uAddCoFaces ( Cells cofaces,
const Cell c,
Dimension  axis 
) const
private

Used by uCoFaces for computing incident cofaces.

◆ uAddFaces()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uAddFaces ( Cells faces,
const Cell c,
Dimension  axis 
) const
private

Used by uFaces for computing incident faces.

◆ uAdjacent()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uAdjacent ( const Cell p,
Dimension  k,
bool  up 
) const

Return the adjacent element to [p] along axis [k] in the given direction and orientation.

Parameters
pany cell.
kthe coordinate that is changed.
upif 'true' the orientation is forward along axis [k], otherwise backward.
Returns
the adjacent element to [p] along axis [k] in the given direction and orientation.
Note
It is an alias to 'up ? uGetIncr( p, k ) : uGetDecr( p, k )'.
Precondition
uIsValid(p) and not uIs(Min|Max)(p, k) depending on up value.
Postcondition
`uIsValid(uAdjacent(p, k, up)) is true.

◆ uCell() [1/3]

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uCell ( const Point kp) const

From the Khalimsky coordinates of a cell, builds the corresponding unsigned cell lying into this Khalismky space.

Along a non-periodic dimension, if the given Khalimsky coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the Khalimsky coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
kpan integer point (Khalimsky coordinates of cell).
Returns
the unsigned cell.
Postcondition
uIsValid(uCell(kp)) is true.

◆ uCell() [2/3]

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uCell ( const PreCell c) const

From an unsigned cell, returns an unsigned cell lying into this Khalismky space.

Along a non-periodic dimension, if the given Khalimsky coordinate lies outside the space, it replaces it by the nearest valid coordinate.

Along a periodic dimension, the Khalimsky coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
ca cell.
Returns
the same cell with appropriate Khalimsky coordinates along periodic dimensions.
Postcondition
uIsValid(uCell(c)) is true.
uCell(c) == c if uIsValid(c).
Examples
geometry/curves/exampleRationalConvexity.cpp, io/boards/dgtalBoard3DTo2D-KSCell.cpp, topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/cubical-complex-collapse.cpp, topology/cubical-complex-illustrations.cpp, and topology/khalimskySpaceScanner.cpp.

Referenced by DGtal::dec_helper::averageOperator20(), cmpUCellsIfInside(), GIVEN(), main(), DGtal::Shortcuts< TKSpace >::CellReader::operator()(), SCENARIO(), testCellDrawOnBoard(), testFaces(), testNeighborhood(), testQuadNorm(), and testScan().

◆ uCell() [3/3]

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::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 lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
canother cell defining the topology.
Returns
the cell having the topology of [c] and the given digital coordinates [p].
Postcondition
uIsValid(uCell(p, c)) is true.

◆ uCoFaces()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uCoFaces ( const Cell c) const

Return the proper cofaces of [c] (chain of upper incidence) that belong to the space.

Parameters
cany unsigned cell.
Returns
the proper cofaces of [c] (chain of upper incidence) that belong to the space.
Precondition
uIsValid(c) is true.
Postcondition
uIsValid(b) is true for every returned cell b.

Referenced by DGtal::CellGeometryFunctions< TKSpace, i, N >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, i, N >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, i, N >::getIncidentKPointsToPoints(), testCellularGridSpaceNDCoFaces(), and testFaces().

◆ uCoord()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::uCoord ( const Cell c,
Dimension  k 
) const

Return its digital coordinate along [k].

Parameters
cany unsigned cell.
kany valid dimension.
Returns
its digital coordinate along [k].
Precondition
uIsValid(c) is true.

◆ uCoords()

template<Dimension dim, typename TInteger >
Point DGtal::KhalimskySpaceND< dim, TInteger >::uCoords ( const Cell c) const

Return its digital coordinates.

Parameters
cany unsigned cell.
Returns
its digital coordinates
Precondition
uIsValid(c) is true.
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by centerSurfel(), DGtal::Shortcuts< TKSpace >::getPrimalVertices(), and main().

◆ uDim()

template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::uDim ( const Cell p) const

◆ uDirs()

template<Dimension dim, typename TInteger >
DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::uDirs ( const Cell p) const

Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell spans.

(A spel spans all coordinates; a surfel all but one, etc).

Example:

...
for ( KSpace::DirIterator q = ks.uDirs( p ); q != 0; ++q )
{
Dimension dir = *q;
...
}
Parameters
pany unsigned cell.
Returns
an iterator that points on the first coordinate spanned by the cell.

Referenced by DGtal::ATSolver2D< TKSpace, TLinearAlgebra >::getOutputScalarFieldV0(), main(), and DGtal::ATSolver2D< TKSpace, TLinearAlgebra >::updateSmallestEpsilonMap().

◆ uDistanceToMax()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::uDistanceToMax ( const Cell p,
Dimension  k 
) const

Useful to check if you are going out of the space (for non-periodic dimensions).

Parameters
pany cell.
kthe coordinate that is tested.
Returns
the number of increment to do to reach the maximum value.
Precondition
uIsValid(p) is true.

◆ uDistanceToMin()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::uDistanceToMin ( const Cell p,
Dimension  k 
) const

Useful to check if you are going out of the space (for non-periodic dimensions).

Parameters
pany cell.
kthe coordinate that is tested.
Returns
the number of decrement to do to reach the minimum value.
Precondition
uIsValid(p) is true.

◆ uFaces()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uFaces ( const Cell c) const

Return the proper faces of [c] (chain of lower incidence) that belong to the space.

Parameters
cany unsigned cell.
Returns
the proper faces of [c] (chain of lower incidence) that belong to the space.
Precondition
uIsValid(c) is true.
Postcondition
uIsValid(b) is true for every returned cell b.

Referenced by DGtal::Shortcuts< TKSpace >::getPrimalCells(), testCellularGridSpaceNDFaces(), and testFaces().

◆ uFirst() [1/2]

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uFirst ( const PreCell p) const

Return the first cell of the space with the same type as [p].

Returns
the first cell of the space with the same type as [p].
Note
Along periodic dimensions, it returns the first unique coordinate of a cell of same type as p.
Postcondition
uIsValid(uFirst(p)) is true.

◆ uFirst() [2/2]

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::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].

Returns
the k-th Khalimsky coordinate of the first cell of the space with the same type as [p].
Note
For periodic dimension, it returns the first unique coordinate of a cell of same type as p.
Postcondition
The returned coordinate is between lowerCell()[k] and upperCell()[k].
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by main().

◆ uGetAdd()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetAdd ( const Cell p,
Dimension  k,
Integer  x 
) const

Return the same element as [p] except for a coordinate [k] incremented with x.

Parameters
pany cell.
kthe coordinate that is changed.
xthe increment.
Returns
the same element as [p] except for a coordinate [k] incremented with x.
Precondition
uIsValid(p) and ( x <= uDistanceToMax(p, k) or isSpacePeriodic(k) ).
Postcondition
uIsValid(uGetAdd(p, k, x)) is true.

◆ uGetDecr()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetDecr ( const Cell p,
Dimension  k 
) const

Return the same element as [p] except for an decremented coordinate [k].

Parameters
pany cell.
kthe coordinate that is changed.
Returns
the same element as [p] except for an decremented coordinate [k].
Precondition
uIsValid(p) and not uIsMin(p).
Postcondition
uIsValid(uGetDecr(p, k)) is true.

◆ uGetIncr()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetIncr ( const Cell p,
Dimension  k 
) const

Return the same element as [p] except for the incremented coordinate [k].

Parameters
pany cell.
kthe coordinate that is changed.
Returns
the same element as [p] except for the incremented coordinate [k].
Precondition
uIsValid(p) and not uIsMax(p).
Postcondition
uIsValid(uGetIncr(p, k)) is true.

◆ uGetMax()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetMax ( Cell  p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe concerned coordinate.
Returns
the cell similar to [p] but with the maximum allowed [k]-coordinate.
Precondition
uIsValid(p, d) is true for each dimension d different than k.
Postcondition
uIsValid(uGetMax(p, k)) is true.
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by main().

◆ uGetMin()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetMin ( Cell  p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe concerned coordinate.
Returns
the cell similar to [p] but with the minimum allowed [k]-coordinate.
Precondition
uIsValid(p, d) is true for each dimension d different than k.
Postcondition
uIsValid(uGetMin(p, k)) is true.

◆ uGetSub()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetSub ( const Cell p,
Dimension  k,
Integer  x 
) const

Return the same element as [p] except for a coordinate [k] decremented with x.

Parameters
pany cell.
kthe coordinate that is changed.
xthe decrement.
Returns
the same element as [p] except for a coordinate [k] decremented with x.
Precondition
uIsValid(p) and ( x <= uDistanceToMin(p, k) or isSpacePeriodic(k) ).
Postcondition
uIsValid(uGetSub(p, k, x)) is true.

◆ uIncident()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::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].

Parameters
cany unsigned cell.
kany coordinate.
upif 'true' the orientation is forward along axis [k], otherwise backward.
Returns
the forward or backward unsigned cell incident to [c] along axis [k], depending on [up].
Note
It may be a lower incident cell if [c] is open along axis [k], else an upper incident cell.
Precondition
uIsValid(c) and the cell should have an incident cell in this direction/orientation.
Postcondition
uIsValid(uIncident(c, k, up)) is true.

Referenced by DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentCellsToPointels(), DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentCellsToPoints(), DGtal::ATSolver2D< TKSpace, TLinearAlgebra >::getOutputScalarFieldV0(), main(), testCellDrawOnBoard(), and DGtal::ATSolver2D< TKSpace, TLinearAlgebra >::updateSmallestEpsilonMap().

◆ uIsInside() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside ( const PreCell p) const

Useful to check if you are going out of the space.

Parameters
pany cell.
Returns
true if [p] has its coordinates within the allowed bounds.
Note
Only the non-periodic dimensions are checked.

◆ uIsInside() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside ( const PreCell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] has its [k]-coordinate within the allowed bounds.
Note
It returns always true for periodic dimension.
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by cmpUCellsIfInside(), main(), testCellularGridSpaceNDCoFaces(), testCellularGridSpaceNDFaces(), testFaces(), testFindABel(), testNeighborhood(), and testSurfelAdjacency().

◆ uIsMax()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsMax ( const Cell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] cannot have its [k]-coordinate augmented without leaving the space.
Note
It returns always false for periodic dimension.
Precondition
uIsInside(p) is true.

◆ uIsMin()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsMin ( const Cell p,
Dimension  k 
) const

Useful to check if you are going out of the space.

Parameters
pany cell.
kthe tested coordinate.
Returns
true if [p] cannot have its [k]-coordinate decreased without leaving the space.
Note
It returns always false for periodic dimension.
Precondition
uIsInside(p) is true.

◆ uIsOpen()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsOpen ( const Cell p,
Dimension  k 
) const

Return 'true' if [p] is open along the direction [k].

Parameters
pany cell.
kany direction.
Returns
'true' if [p] is open along the direction [k].

◆ uIsSurfel()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsSurfel ( const Cell b) const

Return 'true' if [b] is a surfel (spans all but one coordinate).

Parameters
bany unsigned cell.
Returns
'true' if [b] is a surfel (spans all but one coordinate).

◆ uIsValid() [1/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsValid ( const PreCell c) const

Returns true if the given unsigned cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.

Parameters
ca unsigned cell.
Returns
true if the given unsigned cell has Khalimsky coordinates between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.
See also
uCell(const Cell &) const to correct Khalimsky coordinates along periodic dimensions.

◆ uIsValid() [2/2]

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::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 returned by lowerCell and upperCell.

Parameters
can unsigned cell.
ka dimension.
Returns
true if the given unsigned cell has his k-th Khalimsky coordinate between those of the cells returned by lowerCell and upperCell.
Note
For periodic dimension, even if there is no bounds, it guarantees that each cell has unique coordinates.
See also
uCell(const Cell &) const to correct Khalimsky coordinates along periodic dimensions.

◆ uKCoord()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::uKCoord ( const Cell c,
Dimension  k 
) const

Return its Khalimsky coordinate along [k].

Parameters
cany unsigned cell.
kany valid dimension.
Returns
its Khalimsky coordinate along [k].
Precondition
uIsValid(c) is true.

◆ uKCoords()

template<Dimension dim, typename TInteger >
const Point& DGtal::KhalimskySpaceND< dim, TInteger >::uKCoords ( const Cell c) const

◆ uLast() [1/2]

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uLast ( const PreCell p) const

Return the last cell of the space with the same type as [p].

Returns
the last cell of the space with the same type as [p].
Note
Along periodic dimensions, it returns the last unique coordinate of a cell of same type as p.
Postcondition
uIsValid(uLast(p)) is true.

◆ uLast() [2/2]

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::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].

Returns
the k-th Khalimsky coordinate of the last cell of the space with the same type as [p].
Note
For periodic dimension, it returns the last unique coordinate of a cell of same type as p.
Postcondition
The returned coordinate is between lowerCell()[k] and upperCell()[k].
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by main().

◆ uLowerIncident()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uLowerIncident ( const Cell c) const

Return the cells directly low incident to c in this space.

Parameters
cany unsigned cell.
Returns
the cells directly low incident to c in this space.
Precondition
uIsValid(c) is true.
Postcondition
uIsValid(b) is true for every returned cell b.

◆ uNeighborhood()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uNeighborhood ( const Cell cell) const

Computes the 1-neighborhood of the cell [c] and returns it.

It is the set of cells with same topology that are adjacent to [c] and which are within the bounds of this space.

Parameters
cellthe unsigned cell of interest.
Returns
the cells of the 1-neighborhood of [cell].
Precondition
uIsValid(cell) is true.
Postcondition
uIsValid(c) is true for every returned cell c.

Referenced by testNeighborhood().

◆ uNext()

template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uNext ( Cell p,
const Cell lower,
const Cell upper 
) const

Increment the cell [p] to its next position (as classically done in a scanning).

Example:

Cell first, last; // lower and upper bounds
Cell p = first;
do
{ // ... whatever [p] is the current cell
}
while ( K.uNext( p, first, last ) );
Parameters
pany cell.
lowerthe lower bound.
upperthe upper bound.
Returns
true if p is still within the bounds, false if the scanning is finished.
Precondition
uIsValid(p) and uIsValid(lower) and uIsValid(upper) and uTopology(p) == uTopology(lower) == uTopology(upper).
Postcondition
uIsValid(p) is true.
Examples
topology/khalimskySpaceScanner.cpp.

Referenced by main(), and testScan().

◆ unsigns()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::unsigns ( const SCell p) const

◆ uOrthDir()

template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::uOrthDir ( const Cell s) const

Given an unsigned surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is closed).

Parameters
san unsigned surfel
Returns
the orthogonal direction of [s]

◆ uOrthDirs()

template<Dimension dim, typename TInteger >
DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::uOrthDirs ( const Cell p) const

Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell does not span.

(A spel spans all coordinates; a surfel all but one, etc).

Example:

...
for ( KSpace::DirIterator q = ks.uOrthDirs( p ); q != 0; ++q )
{
Dimension dir = *q;
...
}
Parameters
pany unsigned cell.
Returns
an iterator that points on the first coordinate spanned by the cell.

◆ uPointel()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uPointel ( Point  p) const

From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0) lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
Returns
the pointel having the given digital coordinates [p].
Postcondition
uIsValid(uSpel(p)) is true.
Examples
topology/ctopo-1-3d.cpp, and topology/ctopo-1.cpp.

Referenced by DGtal::CellGeometryFunctions< TKSpace, i, N >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentCellsToPoints(), DGtal::CellGeometryFunctions< TKSpace, i, N >::getIncidentKPointsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentKPointsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentKPointsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentKPointsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentKPointsToPoints(), DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentKPointsToPoints(), main(), SCENARIO(), and testCellularGridSpaceNDCoFaces().

◆ upperBound()

template<Dimension dim, typename TInteger >
const Point& DGtal::KhalimskySpaceND< dim, TInteger >::upperBound ( ) const

Return the upper bound for digital points in this space.

Returns
the upper bound for digital points in this space.
Note
For periodic dimension, it returns the upper digital point with unique coordinates. See also the class documentation.
Examples
topology/ctopo-2.cpp, and topology/ctopo-fillContours.cpp.

Referenced by main(), DGtal::Shortcuts< TKSpace >::makeDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeIdxDigitalSurface(), DGtal::Shortcuts< TKSpace >::makeLightDigitalSurfaces(), and TEST_CASE_METHOD().

◆ upperCell()

template<Dimension dim, typename TInteger >
const Cell& DGtal::KhalimskySpaceND< dim, TInteger >::upperCell ( ) const

Return the upper bound for cells in this space.

Returns
the upper bound for cells in this space.
Note
For periodic dimension, it returns the upper cell with unique coordinates. See also the class documentation.

◆ uProject()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uProject ( Cell p,
const Cell bound,
Dimension  k 
) const

Projects [p] along the [k]th direction toward [bound].

Otherwise said, p[ k ] == bound[ k ] afterwards

Parameters
[in,out]pany cell.
[in]boundthe element acting as bound (same topology as p).
[in]kthe concerned coordinate.
Precondition
uIsValid(p) and uIsValid(bound) and uIsOpen(p, k) == uIsOpen(bound, k)
Postcondition
uIsValid(p).

◆ uProjection()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uProjection ( const Cell p,
const Cell bound,
Dimension  k 
) const

Return the projection of [p] along the [k]th direction toward [bound].

Otherwise said, p[ k ] == bound[ k ] afterwards.

Parameters
pany cell.
boundthe element acting as bound (same topology as p).
kthe concerned coordinate.
Returns
the projection.
Precondition
uIsValid(p) and uIsValid(bound) and uIsOpen(p, k) == uIsOpen(bound, k)
Postcondition
uIsValid(uProjection(p, bound, k)) and uTopology(p) == uTopology(uProjection(p, bound, k)).

◆ uProperNeighborhood()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uProperNeighborhood ( const Cell cell) const

Computes the proper 1-neighborhood of the cell [c] and returns it.

It is the set of cells with same topology that are adjacent to [c], different from [c] and which are within the bounds of this space.

Parameters
cellthe unsigned cell of interest.
Returns
the cells of the proper 1-neighborhood of [cell].
Precondition
uIsValid(cell) is true.
Postcondition
uIsValid(c) is true for every returned cell c.

Referenced by testNeighborhood().

◆ uSetCoord()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetCoord ( Cell c,
Dimension  k,
Integer  i 
) const

Sets the [k]-th digital coordinate of [c] to [i].

Parameters
cany unsigned cell.
kany valid dimension.
ian integer coordinate within the space.
Note
The coordinate i will be corrected if k is a periodic dimension.
Precondition
uIsValid(c) is true and i is within the space bounds if k is a non-periodic dimension.
Postcondition
uIsValid(c) is true.

◆ uSetCoords()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetCoords ( Cell c,
const Point kp 
) const

Sets the digital coordinates of [c] to [kp].

Parameters
cany unsigned cell.
kpthe new Khalimsky coordinates for [c].
Note
The coordinates kp will be corrected for periodic dimensions.
Precondition
kp is within the space bounds for non-periodic dimensions.
Postcondition
uIsValid(c) is true.

◆ uSetKCoord()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetKCoord ( Cell c,
Dimension  k,
Integer  i 
) const

Sets the [k]-th Khalimsky coordinate of [c] to [i].

Parameters
cany unsigned cell.
kany valid dimension.
ian integer coordinate within the space.
Note
The coordinate i will be corrected if k is a periodic dimension.
Precondition
uIsValid(c) is true and i is within the space bounds if k is a non-periodic dimension.
Postcondition
uIsValid(c) is true.

◆ uSetKCoords()

template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetKCoords ( Cell c,
const Point kp 
) const

Sets the Khalimsky coordinates of [c] to [kp].

Parameters
cany unsigned cell.
kpthe new Khalimsky coordinates for [c].
Note
The coordinates kp will be corrected for periodic dimensions.
Precondition
kp is within the space bounds for non-periodic dimensions.
Postcondition
uIsValid(c) is true.

◆ uSpel()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uSpel ( Point  p) const

From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimension) lying into this Khalismky space.

Along a non-periodic dimension, if the given digital coordinate lies outside the space, it is replaced by the nearest valid coordinate.

Along a periodic dimension, the digital coordinate is corrected (by periodicity) to lie between the coordinates of lowerCell() and upperCell().

Parameters
pan integer point (digital coordinates of cell).
Returns
the spel having the given digital coordinates [p].
Postcondition
uIsValid(uSpel(p)) is true.
Examples
topology/ctopo-1.cpp, topology/ctopo-fillContours.cpp, topology/cubical-complex-illustrations.cpp, and topology/khalimskySpaceScanner.cpp.

Referenced by main(), SCENARIO(), and testCellularGridSpaceNDFaces().

◆ uTopology()

template<Dimension dim, typename TInteger >
Integer DGtal::KhalimskySpaceND< dim, TInteger >::uTopology ( const Cell p) const

Return the topology word of [p].

Parameters
pany unsigned cell.
Returns
the topology word of [p].

Referenced by testFaces(), testNeighborhood(), and testScan().

◆ uTranslation()

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::uTranslation ( const Cell p,
const Vector vec 
) const

Add the vector [vec] to [p].

Parameters
pany cell.
vecany pointel.
Returns
the unsigned copy of the cell [p] translated by [coord].
Precondition
uIsValid(p, k) and ( uDistanceToMin(p, k) <= vec[k] <= uDistanceToMax(p, k) or isPeriodicSpace(k) ) for each dimension k.
Postcondition
uIsValid(uTranslation(p, vec)) is true.
Examples
io/viewDualSurface.cpp, topology/ctopo-1-3d.cpp, and topology/ctopo-1.cpp.

Referenced by main().

◆ uUpperIncident()

template<Dimension dim, typename TInteger >
Cells DGtal::KhalimskySpaceND< dim, TInteger >::uUpperIncident ( const Cell c) const

Return the cells directly up incident to c in this space.

Parameters
cany unsigned cell.
Returns
the cells directly up incident to c in this space.
Precondition
uIsValid(c) is true.
Postcondition
uIsValid(b) is true for every returned cell b.

Friends And Related Function Documentation

◆ KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > >

template<Dimension dim, typename TInteger >
friend class KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > >
friend

Definition at line 397 of file KhalimskySpaceND.h.

Field Documentation

◆ DIM

template<Dimension dim, typename TInteger >
const constexpr Dimension DGtal::KhalimskySpaceND< dim, TInteger >::DIM = dim
staticconstexpr

Definition at line 431 of file KhalimskySpaceND.h.

◆ dimension

template<Dimension dim, typename TInteger >
const constexpr Dimension DGtal::KhalimskySpaceND< dim, TInteger >::dimension = dim
staticconstexpr

◆ myCellLower

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::myCellLower
private

Definition at line 2049 of file KhalimskySpaceND.h.

◆ myCellUpper

template<Dimension dim, typename TInteger >
Cell DGtal::KhalimskySpaceND< dim, TInteger >::myCellUpper
private

Definition at line 2050 of file KhalimskySpaceND.h.

◆ myClosure

template<Dimension dim, typename TInteger >
std::array<Closure, dimension> DGtal::KhalimskySpaceND< dim, TInteger >::myClosure
private

Definition at line 2051 of file KhalimskySpaceND.h.

◆ myLower

template<Dimension dim, typename TInteger >
Point DGtal::KhalimskySpaceND< dim, TInteger >::myLower
private

Definition at line 2047 of file KhalimskySpaceND.h.

◆ myUpper

template<Dimension dim, typename TInteger >
Point DGtal::KhalimskySpaceND< dim, TInteger >::myUpper
private

Definition at line 2048 of file KhalimskySpaceND.h.

◆ NEG

template<Dimension dim, typename TInteger >
const constexpr Sign DGtal::KhalimskySpaceND< dim, TInteger >::NEG = false
staticconstexpr

◆ POS

template<Dimension dim, typename TInteger >
const constexpr Sign DGtal::KhalimskySpaceND< dim, TInteger >::POS = true
staticconstexpr

The documentation for this class was generated from the following file:
DGtal::KhalimskySpaceND::PERIODIC
@ PERIODIC
The dimension is periodic.
Definition: KhalimskySpaceND.h:475
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::SignedKhalimskyCell
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
Definition: KhalimskySpaceND.h:208
DGtal::KhalimskySpaceND::sDirect
bool sDirect(const SCell &p, Dimension k) const
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
DGtal::KhalimskySpaceND::sSign
Sign sSign(const SCell &c) const
Return its sign.
DGtal::KhalimskySpaceND::POS
static const constexpr Sign POS
Definition: KhalimskySpaceND.h:432
DGtal::KhalimskySpaceND::CLOSED
@ CLOSED
The dimension is closed and non-periodic.
Definition: KhalimskySpaceND.h:473
DGtal::KhalimskySpaceND::DirIterator
typename PreCellularGridSpace::DirIterator DirIterator
Definition: KhalimskySpaceND.h:422
DGtal::KhalimskySpaceND::OPEN
@ OPEN
The dimension is open.
Definition: KhalimskySpaceND.h:474
DGtal::KhalimskySpaceND::sIncident
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].
DGtal::KhalimskyCell< dim, Integer >
DGtal::KhalimskySpaceND::uNext
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).
DGtal::KhalimskySpaceND
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Definition: KhalimskySpaceND.h:64