DGtal  1.5.beta
KhalimskySpaceND.h
1 
17 #pragma once
18 
33 #if defined(KhalimskySpaceND_RECURSES)
34 #error Recursive header files inclusion detected in KhalimskySpaceND.h
35 #else // defined(KhalimskySpaceND_RECURSES)
37 #define KhalimskySpaceND_RECURSES
38 
39 #if !defined KhalimskySpaceND_h
41 #define KhalimskySpaceND_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <set>
47 #include <map>
48 #include <array>
49 #include <DGtal/base/Common.h>
50 #include <DGtal/kernel/CInteger.h>
51 #include <DGtal/kernel/PointVector.h>
52 #include <DGtal/kernel/SpaceND.h>
53 #include <DGtal/topology/KhalimskyPreSpaceND.h>
55 
56 namespace DGtal
57 {
59  // Pre-declaration
60  template <
61  Dimension dim,
62  typename TInteger = DGtal::int32_t
63  >
64  class KhalimskySpaceND;
65 
67 
70  template < class TKhalimskySpace >
72 
74 
80  template < Dimension dim,
81  typename TInteger = DGtal::int32_t >
83  {
84 
87 
88 
89  // Aliases
90  public:
91  using Integer = TInteger;
98 
99  // Friendship
100  friend class KhalimskySpaceND< dim, TInteger >;
102 
103  private:
106 
107  private:
108 
113  explicit KhalimskyCell( const Point & aPoint );
114 
119  explicit KhalimskyCell( const PreCell & aCell );
120 
121  public:
123  operator PreCell const& () const;
124 
126  PreCell const& preCell() const;
127 
128  private:
130  explicit operator PreCell & ();
131 
132  public:
136  explicit KhalimskyCell( Integer dummy = 0 );
137 
141  KhalimskyCell( const KhalimskyCell & other ) = default;
142 
146  KhalimskyCell & operator=( const KhalimskyCell & other ) = default;
147 
151  KhalimskyCell( KhalimskyCell && other ) = default;
152 
156  KhalimskyCell & operator=( KhalimskyCell && other ) = default;
157 
162  bool operator==( const KhalimskyCell & other ) const;
163 
168  bool operator!=( const KhalimskyCell & other ) const;
169 
174  bool operator<( const KhalimskyCell & other ) const;
175 
176  // --------------- CDrawableWithBoard2D realization -------------------
177  public:
178 
183  //DrawableWithBoard2D* defaultStyle( std::string mode = "" ) const;
184 
188  std::string className() const;
189 
190  };
191 
192  template < Dimension dim,
193  typename TInteger >
194  std::ostream &
195  operator<<( std::ostream & out,
196  const KhalimskyCell< dim, TInteger > & object );
197 
198 
200 
206  template < Dimension dim,
207  typename TInteger = DGtal::int32_t >
209  {
212 
213  // Aliases
214  public:
215  using Integer = TInteger;
222 
223  // Friendship
224  friend class KhalimskySpaceND< dim, TInteger >;
226 
227  private:
230 
231  private:
237  explicit SignedKhalimskyCell( const Point & aPoint, bool positive );
238 
243  explicit SignedKhalimskyCell( const SPreCell & aCell );
244 
245  public:
247  operator SPreCell const& () const;
248 
250  SPreCell const& preCell() const;
251 
252  private:
254  explicit operator SPreCell & ();
255 
256  public:
260  explicit SignedKhalimskyCell( Integer dummy = 0 );
261 
265  SignedKhalimskyCell( const SignedKhalimskyCell & other ) = default;
266 
270  SignedKhalimskyCell & operator=( const SignedKhalimskyCell & other ) = default;
271 
276 
281 
286  bool operator==( const SignedKhalimskyCell & other ) const;
287 
292  bool operator!=( const SignedKhalimskyCell & other ) const;
293 
298  bool operator<( const SignedKhalimskyCell & other ) const;
299 
300  // --------------- CDrawableWithBoard2D realization -------------------
301  public:
302 
307  //DrawableWithBoard2D* defaultStyle( std::string mode = "" ) const;
308 
313  std::string className() const;
314 
315  };
316 
317  template < Dimension dim,
318  typename TInteger >
319  std::ostream &
320  operator<<( std::ostream & out,
321  const SignedKhalimskyCell< dim, TInteger > & object );
322 
324  // template class KhalimskySpaceND
388  template <
389  Dimension dim,
390  typename TInteger
391  >
393  : private KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > >
394  {
395 
397  friend class KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > >;
398 
401 
402  public:
404  typedef TInteger Integer;
405 
408 
409  // Spaces
413 
414  // Cells
419 
420  typedef SCell Surfel;
421  typedef bool Sign;
423 
424  // Points and Vectors
427 
428 
429  // static constants
430  static const constexpr Dimension dimension = dim;
431  static const constexpr Dimension DIM = dim;
432  static const constexpr Sign POS = true;
433  static const constexpr Sign NEG = false;
434 
435  template < typename CellType >
436  using AnyCellCollection = typename PreCellularGridSpace::template AnyCellCollection< CellType >;
437 
438  // Neighborhoods, Incident cells, Faces and Cofaces
441 
442  // Sets, Maps
444  typedef std::set<Cell> CellSet;
445 
447  typedef std::set<SCell> SCellSet;
448 
450  typedef std::set<SCell> SurfelSet;
451 
454  template <typename Value> struct CellMap {
455  typedef std::map<Cell,Value> Type;
456  };
457 
460  template <typename Value> struct SCellMap {
461  typedef std::map<SCell,Value> Type;
462  };
463 
466  template <typename Value> struct SurfelMap {
467  typedef std::map<SCell,Value> Type;
468  };
469 
471  enum Closure
472  {
475  PERIODIC
476  };
477 
478  // ----------------------- Standard services ------------------------------
482  public:
483 
486 
489 
500  const Point & upper,
501  bool isClosed );
502 
507  KhalimskySpaceND ( const KhalimskySpaceND & other ) = default;
508 
514  KhalimskySpaceND & operator= ( const KhalimskySpaceND & other ) = default;
515 
520  KhalimskySpaceND ( KhalimskySpaceND && other ) = default;
521 
528 
539  bool init( const Point & lower,
540  const Point & upper,
541  bool isClosed );
542 
554  bool init( const Point & lower,
555  const Point & upper,
556  Closure closure );
557 
569  bool init( const Point & lower,
570  const Point & upper,
571  const std::array<Closure, dim> & closure );
572 
574 
575  // ------------------------- Basic services ------------------------------
579  public:
580 
587  Size size( Dimension k ) const;
588 
595  Integer min( Dimension k ) const;
596 
603  Integer max( Dimension k ) const;
604 
610  const Point & lowerBound() const;
611 
617  const Point & upperBound() const;
618 
624  const Cell & lowerCell() const;
625 
631  const Cell & upperCell() const;
632 
645  bool uIsValid( const PreCell & c, Dimension k ) const;
646 
658  bool uIsValid( const PreCell & c ) const;
659 
672  bool sIsValid( const SPreCell & c, Dimension k ) const;
673 
685  bool sIsValid( const SPreCell & c ) const;
686 
697  bool cIsValid( const Point & p, Dimension k ) const;
698 
708  bool cIsValid( const Point & p ) const;
709 
711 
712  // ----------------------- Closure type query --------------------------
716  public:
717 
722  bool isSpaceClosed() const;
723 
729  bool isSpaceClosed( Dimension k ) const;
730 
735  bool isSpacePeriodic() const;
736 
742  bool isSpacePeriodic( Dimension k ) const;
743 
749 
755 
757 
758  // ----------------------- Cell creation services --------------------------
762  public:
763 
778  Cell uCell( const PreCell & c ) const;
779 
793  Cell uCell( const Point & kp ) const;
794 
810  Cell uCell( Point p, const PreCell & c ) const;
811 
826  SCell sCell( const SPreCell & c ) const;
827 
842  SCell sCell( const Point & kp, Sign sign = POS ) const;
843 
859  SCell sCell( Point p, const SPreCell & c ) const;
860 
874  Cell uSpel( Point p ) const;
875 
890  SCell sSpel( Point p, Sign sign = POS ) const;
891 
905  Cell uPointel( Point p ) const;
906 
922  SCell sPointel( Point p, Sign sign = POS ) const;
923 
925 
926  // ----------------------- Read accessors to cells ------------------------
930  public:
938  Integer uKCoord( const Cell & c, Dimension k ) const;
939 
947  Integer uCoord( const Cell & c, Dimension k ) const;
948 
955  const Point & uKCoords( const Cell & c ) const;
956 
963  Point uCoords( const Cell & c ) const;
964 
972  Integer sKCoord( const SCell & c, Dimension k ) const;
973 
981  Integer sCoord( const SCell & c, Dimension k ) const;
982 
989  const Point & sKCoords( const SCell & c ) const;
990 
997  Point sCoords( const SCell & c ) const;
998 
1005  Sign sSign( const SCell & c ) const;
1006 
1008 
1009  // ----------------------- Write accessors to cells ------------------------
1013  public:
1014 
1023  void uSetKCoord( Cell & c, Dimension k, Integer i ) const;
1024 
1033  void sSetKCoord( SCell & c, Dimension k, Integer i ) const;
1034 
1043  void uSetCoord( Cell & c, Dimension k, Integer i ) const;
1044 
1053  void sSetCoord( SCell & c, Dimension k, Integer i ) const;
1054 
1063  void uSetKCoords( Cell & c, const Point & kp ) const;
1064 
1072  void sSetKCoords( SCell & c, const Point & kp ) const;
1073 
1081  void uSetCoords( Cell & c, const Point & kp ) const;
1082 
1090  void sSetCoords( SCell & c, const Point & kp ) const;
1091 
1096  void sSetSign( SCell & c, Sign s ) const;
1097 
1099 
1100  // -------------------- Conversion signed/unsigned ------------------------
1104  public:
1113  SCell signs( const Cell & p, Sign s ) const;
1114 
1122  Cell unsigns( const SCell & p ) const;
1123 
1131  SCell sOpp( const SCell & p ) const;
1132 
1134 
1135  // ------------------------- Cell topology services -----------------------
1139  public:
1145  Integer uTopology( const Cell & p ) const;
1146 
1152  Integer sTopology( const SCell & p ) const;
1153 
1159  Dimension uDim( const Cell & p ) const;
1160 
1166  Dimension sDim( const SCell & p ) const;
1167 
1173  bool uIsSurfel( const Cell & b ) const;
1174 
1180  bool sIsSurfel( const SCell & b ) const;
1181 
1188  bool uIsOpen( const Cell & p, Dimension k ) const;
1189 
1196  bool sIsOpen( const SCell & p, Dimension k ) const;
1197 
1199 
1200  // -------------------- Iterator services for cells ------------------------
1204  public:
1205 
1227  DirIterator uDirs( const Cell & p ) const;
1228 
1250  DirIterator sDirs( const SCell & p ) const;
1251 
1273  DirIterator uOrthDirs( const Cell & p ) const;
1274 
1296  DirIterator sOrthDirs( const SCell & p ) const;
1297 
1304  Dimension uOrthDir( const Cell & s ) const;
1305 
1312  Dimension sOrthDir( const SCell & s ) const;
1313 
1315 
1316  // -------------------- Unsigned cell geometry services --------------------
1320  public:
1321 
1328  Integer uFirst( const PreCell & p, Dimension k ) const;
1329 
1336  Cell uFirst( const PreCell & p ) const;
1337 
1344  Integer uLast( const PreCell & p, Dimension k ) const;
1345 
1352  Cell uLast( const PreCell & p ) const;
1353 
1364  Cell uGetIncr( const Cell & p, Dimension k ) const;
1365 
1375  bool uIsMax( const Cell & p, Dimension k ) const;
1376 
1377 
1385  bool uIsInside( const PreCell & p, Dimension k ) const;
1386 
1387 
1394  bool uIsInside( const PreCell & p ) const;
1395 
1403  bool cIsInside( const Point & p, Dimension k ) const;
1404 
1405 
1412  bool cIsInside( const Point & p ) const;
1413 
1423  Cell uGetMax( Cell p, Dimension k ) const;
1424 
1435  Cell uGetDecr( const Cell & p, Dimension k ) const;
1436 
1446  bool uIsMin( const Cell & p, Dimension k ) const;
1447 
1457  Cell uGetMin( Cell p, Dimension k ) const;
1458 
1459 
1471  Cell uGetAdd( const Cell & p, Dimension k, Integer x ) const;
1472 
1484  Cell uGetSub( const Cell & p, Dimension k, Integer x ) const;
1485 
1493  Integer uDistanceToMax( const Cell & p, Dimension k ) const;
1494 
1503  Integer uDistanceToMin( const Cell & p, Dimension k ) const;
1504 
1513  Cell uTranslation( const Cell & p, const Vector & vec ) const;
1514 
1527  Cell uProjection( const Cell & p, const Cell & bound, Dimension k ) const;
1528 
1540  void uProject( Cell & p, const Cell & bound, Dimension k ) const;
1541 
1565  bool uNext( Cell & p, const Cell & lower, const Cell & upper ) const;
1566 
1568 
1569  // -------------------- Signed cell geometry services --------------------
1573  public:
1574 
1581  Integer sFirst( const SPreCell & p, Dimension k ) const;
1582 
1589  SCell sFirst( const SPreCell & p ) const;
1590 
1597  Integer sLast( const SPreCell & p, Dimension k ) const;
1598 
1605  SCell sLast( const SPreCell & p ) const;
1606 
1617  SCell sGetIncr( const SCell & p, Dimension k ) const;
1618 
1628  bool sIsMax( const SCell & p, Dimension k ) const;
1629 
1637  bool sIsInside( const SPreCell & p, Dimension k ) const;
1638 
1645  bool sIsInside( const SPreCell & p ) const;
1646 
1656  SCell sGetMax( SCell p, Dimension k ) const;
1657 
1668  SCell sGetDecr( const SCell & p, Dimension k ) const;
1669 
1679  bool sIsMin( const SCell & p, Dimension k ) const;
1680 
1690  SCell sGetMin( SCell p, Dimension k ) const;
1691 
1703  SCell sGetAdd( const SCell & p, Dimension k, Integer x ) const;
1704 
1716  SCell sGetSub( const SCell & p, Dimension k, Integer x ) const;
1717 
1725  Integer sDistanceToMax( const SCell & p, Dimension k ) const;
1726 
1735  Integer sDistanceToMin( const SCell & p, Dimension k ) const;
1736 
1745  SCell sTranslation( const SCell & p, const Vector & vec ) const;
1746 
1759  SCell sProjection( const SCell & p, const SCell & bound, Dimension k ) const;
1760 
1772  void sProject( SCell & p, const SCell & bound, Dimension k ) const;
1773 
1797  bool sNext( SCell & p, const SCell & lower, const SCell & upper ) const;
1798 
1800 
1801  // ----------------------- Neighborhood services --------------------------
1805  public:
1806 
1818  Cells uNeighborhood( const Cell & cell ) const;
1819 
1831  SCells sNeighborhood( const SCell & cell ) const;
1832 
1845  Cells uProperNeighborhood( const Cell & cell ) const;
1846 
1859  SCells sProperNeighborhood( const SCell & cell ) const;
1860 
1874  Cell uAdjacent( const Cell & p, Dimension k, bool up ) const;
1875 
1889  SCell sAdjacent( const SCell & p, Dimension k, bool up ) const;
1890 
1892 
1893  // ----------------------- Incidence services --------------------------
1897  public:
1898 
1913  Cell uIncident( const Cell & c, Dimension k, bool up ) const;
1914 
1932  SCell sIncident( const SCell & c, Dimension k, bool up ) const;
1933 
1941  Cells uLowerIncident( const Cell & c ) const;
1942 
1950  Cells uUpperIncident( const Cell & c ) const;
1951 
1960  SCells sLowerIncident( const SCell & c ) const;
1961 
1970  SCells sUpperIncident( const SCell & c ) const;
1971 
1979  Cells uFaces( const Cell & c ) const;
1980 
1988  Cells uCoFaces( const Cell & c ) const;
1989 
2006  bool sDirect( const SCell & p, Dimension k ) const;
2007 
2019  SCell sDirectIncident( const SCell & p, Dimension k ) const;
2020 
2032  SCell sIndirectIncident( const SCell & p, Dimension k ) const;
2033 
2034 
2035 
2042  Point interiorVoxel( const SCell & c ) const;
2043 
2050  Point exteriorVoxel( const SCell & c ) const;
2051 
2053 
2054  // ----------------------- Interface --------------------------------------
2058  public:
2059 
2064  void selfDisplay ( std::ostream & out ) const;
2065 
2070  bool isValid() const;
2071 
2073 
2074  // ------------------------- Protected Datas ------------------------------
2075  private:
2076  // ------------------------- Private Datas --------------------------------
2077  private:
2082  std::array<Closure, dimension> myClosure;
2083 
2084  // ------------------------- Hidden services ------------------------------
2085  protected:
2086 
2087 
2088  private:
2089 
2090 
2091 
2092  // ------------------------- Internals ------------------------------------
2096  private:
2098  void uAddFaces( Cells& faces, const Cell& c, Dimension axis ) const;
2099 
2101  void uAddCoFaces( Cells& cofaces, const Cell& c, Dimension axis ) const;
2102 
2104 
2105  }; // end of class KhalimskySpaceND
2106 
2107 
2114  template < Dimension dim,
2115  typename TInteger >
2116  std::ostream&
2117  operator<< ( std::ostream & out,
2118  const KhalimskySpaceND<dim, TInteger > & object );
2119 
2120 } // namespace DGtal
2121 
2122 
2124 // Includes inline functions.
2125 #include "DGtal/topology/KhalimskySpaceND.ih"
2126 
2127 // //
2129 
2130 #endif // !defined KhalimskySpaceND_h
2131 
2132 #undef KhalimskySpaceND_RECURSES
2133 #endif // else defined(KhalimskySpaceND_RECURSES)
Aim: This class is a model of CPreCellularGridSpaceND. It represents the cubical grid as a cell compl...
PreCellDirectionIterator< dim, Integer > DirIterator
Internal class of KhalimskySpaceND that provides some optimizations depending on the space type.
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
Point interiorVoxel(const SCell &c) const
For a given surfel ((n-1)-signed cell), returns its interior voxel (point in Z^d given by the direct ...
static constexpr const Sign NEG
void sSetSign(SCell &c, Sign s) const
Sets the sign of the cell.
bool sIsValid(const SPreCell &c, Dimension k) const
Returns true if the given signed cell his k-th Khalimsky coordinate between those of the cells return...
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).
std::set< SCell > SurfelSet
Preferred type for defining a set of surfels (always signed cells).
Cell uSpel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
bool uIsInside(const PreCell &p, Dimension k) const
Useful to check if you are going out of the space.
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].
Cells uCoFaces(const Cell &c) const
Return the proper cofaces of [c] (chain of upper incidence) that belong to the space.
void uSetKCoords(Cell &c, const Point &kp) const
Sets the Khalimsky coordinates of [c] to [kp].
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
void selfDisplay(std::ostream &out) const
Writes/Displays the object on an output stream.
Cell uProjection(const Cell &p, const Cell &bound, Dimension k) const
Return the projection of [p] along the [k]th direction toward [bound].
Cell uGetDecr(const Cell &p, Dimension k) const
Return the same element as [p] except for an decremented coordinate [k].
bool init(const Point &lower, const Point &upper, bool isClosed)
Specifies the upper and lower bounds for the maximal cells in this space.
Cells uUpperIncident(const Cell &c) const
Return the cells directly up incident to c in this space.
SCell sIndirectIncident(const SCell &p, Dimension k) const
Return the indirect incident cell of [p] along [k] (the incident cell along [k] whose sign is negativ...
Cell uTranslation(const Cell &p, const Vector &vec) const
Add the vector [vec] to [p].
Cell uFirst(const PreCell &p) const
Return the first cell of the space with the same type as [p].
bool sIsMax(const SCell &p, Dimension k) const
Useful to check if you are going out of the space.
Integer uKCoord(const Cell &c, Dimension k) const
Return its Khalimsky coordinate along [k].
Dimension sOrthDir(const SCell &s) const
Given a signed surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel is c...
Integer uDistanceToMin(const Cell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
Cell uCell(const Point &kp) const
From the Khalimsky coordinates of a cell, builds the corresponding unsigned cell lying into this Khal...
Cell unsigns(const SCell &p) const
Creates an unsigned cell from a signed one.
DirIterator uDirs(const Cell &p) const
Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell spans.
bool isSpaceClosed() const
Return 'true' iff the space is closed or periodic along every dimension.
void sSetKCoords(SCell &c, const Point &kp) const
Sets the Khalimsky coordinates of [c] to [kp].
bool cIsInside(const Point &p) const
Useful to check if you are going out of the space.
bool isValid() const
Checks the validity/consistency of the object.
void uSetKCoord(Cell &c, Dimension k, Integer i) const
Sets the [k]-th Khalimsky coordinate of [c] to [i].
static constexpr const Sign POS
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
KhalimskySpaceND()
Default constructor.
DirIterator uOrthDirs(const Cell &p) const
Given an unsigned cell [p], returns an iterator to iterate over each coordinate the cell does not spa...
Cells uFaces(const Cell &c) const
Return the proper faces of [c] (chain of lower incidence) that belong to the space.
SCell sProjection(const SCell &p, const SCell &bound, Dimension k) const
Return the projection of [p] along the [k]th direction toward [bound].
Integer sKCoord(const SCell &c, Dimension k) const
Return its Khalimsky coordinate along [k].
Point sCoords(const SCell &c) const
Return its digital coordinates.
Integer uCoord(const Cell &c, Dimension k) const
Return its digital coordinate along [k].
Cells uNeighborhood(const Cell &cell) const
Computes the 1-neighborhood of the cell [c] and returns it.
Dimension uOrthDir(const Cell &s) const
Given an unsigned surfel [s], returns its orthogonal direction (ie, the coordinate where the surfel i...
std::array< Closure, dimension > myClosure
void uProject(Cell &p, const Cell &bound, Dimension k) const
Projects [p] along the [k]th direction toward [bound].
bool uIsValid(const PreCell &c) const
Returns true if the given unsigned cell has Khalimsky coordinates between those of the cells returned...
SignedKhalimskyPreCell< dim, Integer > SPreCell
Cell uGetMax(Cell p, Dimension k) const
Useful to check if you are going out of the space.
SCell sGetSub(const SCell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] decremented with x.
SCell sOpp(const SCell &p) const
Creates the signed cell with the inverse sign of [p].
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].
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).
void uSetCoords(Cell &c, const Point &kp) const
Sets the digital coordinates of [c] to [kp].
SCell sLast(const SPreCell &p) const
Return the last cell of the space with the same type as [p].
void sProject(SCell &p, const SCell &bound, Dimension k) const
Projects [p] along the [k]th direction toward [bound].
bool cIsValid(const Point &p) const
Returns true if the given cell has Khalimsky coordinates between those of the cells returned by lower...
static constexpr const Dimension dimension
const Point & sKCoords(const SCell &c) const
Return its Khalimsky coordinates.
Size size(Dimension k) const
Return the width of the space in the k-dimension.
KhalimskySpaceND(const Point &lower, const Point &upper, bool isClosed)
Constructor from upper and lower bounds for the maximal cells in this space.
KhalimskySpaceND(KhalimskySpaceND &&other)=default
Move constructor.
SCell sGetMin(SCell p, Dimension k) const
Useful to check if you are going out of the space.
Cell uPointel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
SCell signs(const Cell &p, Sign s) const
Creates a signed cell from an unsigned one and a given sign.
KhalimskyPreSpaceND< dim, Integer > PreCellularGridSpace
SCell sGetDecr(const SCell &p, Dimension k) const
Return the same element as [p] except for an decremented coordinate [k].
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].
bool sIsInside(const SPreCell &p) const
Useful to check if you are going out of the space.
Integer max(Dimension k) const
Return the maximal digital coordinate in the k-dimension.
bool sDirect(const SCell &p, Dimension k) const
Return 'true' if the direct orientation of [p] along [k] is in the positive coordinate direction.
void sSetCoords(SCell &c, const Point &kp) const
Sets the digital coordinates of [c] to [kp].
void uAddFaces(Cells &faces, const Cell &c, Dimension axis) const
Used by uFaces for computing incident faces.
KhalimskySpaceND(const KhalimskySpaceND &other)=default
Copy constructor.
SCells sLowerIncident(const SCell &c) const
Return the signed cells directly low incident to c in this space.
Integer sTopology(const SCell &p) const
Return the topology word of [p].
Integer min(Dimension k) const
Return the minimal digital coordinate in the k-dimension.
bool sIsMin(const SCell &p, Dimension k) const
Useful to check if you are going out of the space.
const Cell & lowerCell() const
Return the lower bound for cells in this space.
SCell sCell(const SPreCell &c) const
From a signed cell, returns a signed cell lying into this Khalismky space.
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...
SCell sGetAdd(const SCell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] incremented with x.
PointVector< dim, Integer > Point
SCells sProperNeighborhood(const SCell &cell) const
Computes the proper 1-neighborhood of the cell [c] and returns it.
Integer uTopology(const Cell &p) const
Return the topology word of [p].
KhalimskySpaceNDHelper< KhalimskySpaceND< dim, TInteger > > Helper
Features basic operations on coordinates, especially for periodic dimensions.
Cells uLowerIncident(const Cell &c) const
Return the cells directly low incident to c in this space.
Cells uProperNeighborhood(const Cell &cell) const
Computes the proper 1-neighborhood of the cell [c] and returns it.
Cell uGetIncr(const Cell &p, Dimension k) const
Return the same element as [p] except for the incremented coordinate [k].
SignedKhalimskyCell< dim, Integer > SCell
SCell sSpel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding spel (cell of maximal dimensi...
SCells sUpperIncident(const SCell &c) const
Return the signed cells directly up incident to c in this space.
bool uIsInside(const PreCell &p) const
Useful to check if you are going out of the space.
bool uIsMax(const Cell &p, Dimension k) const
Useful to check if you are going out of the space.
Cell uCell(const PreCell &c) const
From an unsigned cell, returns an unsigned cell lying into this Khalismky space.
Closure getClosure(Dimension k) const
Gets closure type.
Integer sDistanceToMin(const SCell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
bool isSpacePeriodic() const
Return 'true' iff the space is periodic along every dimension.
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.
~KhalimskySpaceND()
Destructor.
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be signed to characterize a ring.
void sSetCoord(SCell &c, Dimension k, Integer i) const
Sets the [k]-th digital coordinate of [c] to [i].
static constexpr const Dimension DIM
Cell uGetAdd(const Cell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] incremented with x.
Integer 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].
SCell sGetMax(SCell p, Dimension k) const
Useful to check if you are going out of the space.
bool uIsSurfel(const Cell &b) const
Return 'true' if [b] is a surfel (spans all but one coordinate).
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].
bool sIsValid(const SPreCell &c) const
Returns true if the given signed cell has Khalimsky coordinates between those of the cells returned b...
SCell sTranslation(const SCell &p, const Vector &vec) const
Add the vector [vec] to [p].
SCell sDirectIncident(const SCell &p, Dimension k) const
Return the direct incident cell of [p] along [k] (the incident cell along [k])
void uAddCoFaces(Cells &cofaces, const Cell &c, Dimension axis) const
Used by uCoFaces for computing incident cofaces.
bool uIsOpen(const Cell &p, Dimension k) const
Return 'true' if [p] is open along the direction [k].
std::set< Cell > CellSet
Preferred type for defining a set of Cell(s).
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 ...
void uSetCoord(Cell &c, Dimension k, Integer i) const
Sets the [k]-th digital coordinate of [c] to [i].
bool sIsSurfel(const SCell &b) const
Return 'true' if [b] is a surfel (spans all but one coordinate).
bool init(const Point &lower, const Point &upper, Closure closure)
Specifies the upper and lower bounds for the maximal cells in this space.
Closure
Boundaries closure type.
@ CLOSED
The dimension is closed and non-periodic.
@ OPEN
The dimension is open.
@ PERIODIC
The dimension is periodic.
SpaceND< dim, Integer > Space
SCells sNeighborhood(const SCell &cell) const
Computes the 1-neighborhood of the cell [c] and returns it.
typename PreCellularGridSpace::template AnyCellCollection< CellType > AnyCellCollection
bool sIsInside(const SPreCell &p, Dimension k) const
Useful to check if you are going out of the space.
bool isAnyDimensionPeriodic() const
Return 'true' iff the space is periodic along at least one dimension.
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 ...
Integer sCoord(const SCell &c, Dimension k) const
Return its digital coordinate along [k].
SCell sFirst(const SPreCell &p) const
Return the first cell of the space with the same type as [p].
const Point & lowerBound() const
Return the lower bound for digital points in this space.
AnyCellCollection< SCell > SCells
bool uIsMin(const Cell &p, Dimension k) const
Useful to check if you are going out of the space.
DirIterator sOrthDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell does not span.
Sign sSign(const SCell &c) const
Return its sign.
Dimension uDim(const Cell &p) const
Return the dimension of the cell [p].
Cell uGetSub(const Cell &p, Dimension k, Integer x) const
Return the same element as [p] except for a coordinate [k] decremented with x.
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.
Point uCoords(const Cell &c) const
Return its digital coordinates.
KhalimskySpaceND< dim, Integer > CellularGridSpace
Cell uGetMin(Cell p, Dimension k) const
Useful to check if you are going out of the space.
SCell sPointel(Point p, Sign sign=POS) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
bool isSpaceClosed(Dimension k) const
Return 'true' iff the space is closed or periodic along the specified dimension.
Integer uDistanceToMax(const Cell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
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.
Integer sDistanceToMax(const SCell &p, Dimension k) const
Useful to check if you are going out of the space (for non-periodic dimensions).
PointVector< dim, Integer > Vector
bool sIsOpen(const SCell &p, Dimension k) const
Return 'true' if [p] is open along the direction [k].
bool cIsInside(const Point &p, Dimension k) const
Useful to check if you are going out of the space.
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].
KhalimskyPreCell< dim, Integer > PreCell
const Cell & upperCell() const
Return the upper bound for cells in this space.
KhalimskySpaceND & operator=(const KhalimskySpaceND &other)=default
Copy operator.
typename PreCellularGridSpace::DirIterator DirIterator
const Point & upperBound() const
Return the upper bound for digital points in this space.
Point exteriorVoxel(const SCell &c) const
For a given surfel ((n-1)-signed cell), returns its exterior voxel (point in Z^d given by the indirec...
std::set< SCell > SCellSet
Preferred type for defining a set of SCell(s).
Dimension sDim(const SCell &p) const
Return the dimension of the cell [p].
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 ...
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...
const Point & uKCoords(const Cell &c) const
Return its Khalimsky coordinates.
Cell uLast(const PreCell &p) const
Return the last cell of the space with the same type as [p].
void sSetKCoord(SCell &c, Dimension k, Integer i) const
Sets the [k]-th Khalimsky coordinate of [c] to [i].
KhalimskyCell< dim, Integer > Cell
SCell sGetIncr(const SCell &p, Dimension k) const
Return the same element as [p] except for the incremented coordinate [k].
bool isSpacePeriodic(Dimension k) const
Return 'true' iff the space is periodic along the specified dimension.
AnyCellCollection< Cell > Cells
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
DGtal::uint32_t Dimension
Definition: Common.h:136
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
Represents an (unsigned) cell in a cellular grid space by its Khalimsky coordinates.
bool operator!=(const KhalimskyCell &other) const
Difference operator.
KhalimskyCell(const KhalimskyCell &other)=default
Copy constructor.
KhalimskyCell(const Point &aPoint)
Explicit constructor from its Khalimsky coordinates.
KhalimskyCell & operator=(KhalimskyCell &&other)=default
Move operator.
std::string className() const
Return the style name used for drawing this object.
PreCell myPreCell
Underlying pre-cell.
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
bool operator<(const KhalimskyCell &other) const
Inferior operator. (lexicographic order).
KhalimskyCell & operator=(const KhalimskyCell &other)=default
Copy operator.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be a model of the concept CInteger.
PreCell const & preCell() const
Returns the underlying constant pre-cell.
KhalimskyCell(Integer dummy=0)
Default constructor.
KhalimskyCell(KhalimskyCell &&other)=default
Move constructor.
bool operator==(const KhalimskyCell &other) const
Equality operator.
KhalimskyCell(const PreCell &aCell)
Explicit constructor from a KhalimskyPreCell.
std::map< Cell, Value > Type
std::map< SCell, Value > Type
std::decay< T >::type UnsignedVersion
Alias to the unsigned version of the number type.
Definition: NumberTraits.h:90
Represents a signed cell in a cellular grid space by its Khalimsky coordinates and a boolean value.
bool operator<(const SignedKhalimskyCell &other) const
Inferior operator. (lexicographic order).
std::string className() const
Return the style name used for drawing this object.
SignedKhalimskyCell(const Point &aPoint, bool positive)
Explicit constructor from its Khalimsky coordinates.
typename NumberTraits< Integer >::UnsignedVersion UnsignedInteger
SignedKhalimskyCell(SignedKhalimskyCell &&other)=default
Move constructor.
SPreCell mySPreCell
Underlying signed pre-cell.
SPreCell const & preCell() const
Returns the underlying constant signed pre-cell.
bool operator!=(const SignedKhalimskyCell &other) const
Difference operator.
SignedKhalimskyCell & operator=(const SignedKhalimskyCell &other)=default
Copy operator.
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
Integer must be a model of the concept CInteger.
bool operator==(const SignedKhalimskyCell &other) const
Equality operator.
SignedKhalimskyCell(const SPreCell &aCell)
Explicit constructor from a SignedKhalimskyPreCell.
SignedKhalimskyCell(const SignedKhalimskyCell &other)=default
Copy constructor.
SignedKhalimskyCell & operator=(SignedKhalimskyCell &&other)=default
Move operator.
SignedKhalimskyCell(Integer dummy=0)
Default constructor.
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...
Definition: CInteger.h:88
const Point aPoint(3, 4)
unsigned int dim(const Vector &z)
Vector lower(const Vector &z, unsigned int k)
Vector upper(const Vector &z, unsigned int k)