DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
DGtal::KhalimskySpaceND< dim, TInteger > Class Template Reference

#include <KhalimskySpaceND.h>

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

Data Structures

struct  AnyCellCollection
struct  CellMap
struct  SCellMap
struct  SurfelMap

Public Types

typedef TInteger Integer
typedef NumberTraits< Integer >
::UnsignedVersion 
Size
typedef KhalimskyCell< dim,
Integer
Cell
typedef SignedKhalimskyCell
< dim, Integer
SCell
typedef SCell Surfel
typedef bool Sign
typedef CellDirectionIterator
< dim, Integer
DirIterator
typedef PointVector< dim, IntegerPoint
typedef PointVector< dim, IntegerVector
typedef SpaceND< dim, IntegerSpace
typedef KhalimskySpaceND< dim,
Integer
KhalimskySpace
typedef AnyCellCollection< CellCells
typedef AnyCellCollection< SCellSCells
typedef std::set< CellCellSet
typedef std::set< SCellSCellSet
typedef std::set< SCellSurfelSet

Public Member Functions

 ~KhalimskySpaceND ()
 KhalimskySpaceND ()
 KhalimskySpaceND (const KhalimskySpaceND &other)
KhalimskySpaceNDoperator= (const KhalimskySpaceND &other)
bool init (const Point &lower, const Point &upper, bool closed)
Size size (Dimension k) const
Integer min (Dimension k) const
Integer max (Dimension k) const
const PointlowerBound () const
const PointupperBound () const
const CelllowerCell () const
const CellupperCell () const
bool isSpaceClosed () const
Cell uCell (const Point &kp) const
Cell uCell (const Point &p, const Cell &c) const
SCell sCell (const Point &kp, Sign sign=POS) const
SCell sCell (const Point &p, const SCell &c) const
Cell uSpel (const Point &p) const
SCell sSpel (const Point &p, Sign sign=POS) const
Cell uPointel (const Point &p) const
SCell sPointel (const Point &p, Sign sign=POS) const
Integer uKCoord (const Cell &c, Dimension k) const
Integer uCoord (const Cell &c, Dimension k) const
Point uKCoords (const Cell &c) const
Point uCoords (const Cell &c) const
Integer sKCoord (const SCell &c, Dimension k) const
Integer sCoord (const SCell &c, Dimension k) const
Point sKCoords (const SCell &c) const
Point sCoords (const SCell &c) const
Sign sSign (const SCell &c) const
void uSetKCoord (Cell &c, Dimension k, const Integer &i) const
void sSetKCoord (SCell &c, Dimension k, const Integer &i) const
void uSetCoord (Cell &c, Dimension k, Integer i) const
void sSetCoord (SCell &c, Dimension k, Integer i) const
void uSetKCoords (Cell &c, const Point &kp) const
void sSetKCoords (SCell &c, const Point &kp) const
void uSetCoords (Cell &c, const Point &kp) const
void sSetCoords (SCell &c, const Point &kp) const
void sSetSign (SCell &c, Sign s) const
SCell signs (const Cell &p, Sign s) const
Cell unsigns (const SCell &p) const
SCell sOpp (const SCell &p) const
Integer uTopology (const Cell &p) const
Integer sTopology (const SCell &p) const
Dimension uDim (const Cell &p) const
Dimension sDim (const SCell &p) const
bool uIsSurfel (const Cell &b) const
bool sIsSurfel (const SCell &b) const
bool uIsOpen (const Cell &p, Dimension k) const
bool sIsOpen (const SCell &p, Dimension k) const
DirIterator uDirs (const Cell &p) const
DirIterator sDirs (const SCell &p) const
DirIterator uOrthDirs (const Cell &p) const
DirIterator sOrthDirs (const SCell &p) const
Dimension uOrthDir (const Cell &s) const
Dimension sOrthDir (const SCell &s) const
Cell uFirst (const Cell &p) const
Cell uLast (const Cell &p) const
Cell uGetIncr (const Cell &p, Dimension k) const
bool uIsMax (const Cell &p, Dimension k) const
bool uIsInside (const Cell &p, Dimension k) const
Cell uGetMax (const Cell &p, Dimension k) const
Cell uGetDecr (const Cell &p, Dimension k) const
bool uIsMin (const Cell &p, Dimension k) const
Cell uGetMin (const Cell &p, Dimension k) const
Cell uGetAdd (const Cell &p, Dimension k, const Integer &x) const
Cell uGetSub (const Cell &p, Dimension k, const Integer &x) const
Integer uDistanceToMax (const Cell &p, Dimension k) const
Integer uDistanceToMin (const Cell &p, Dimension k) const
Cell uTranslation (const Cell &p, const Vector &vec) const
Cell uProjection (const Cell &p, const Cell &bound, Dimension k) const
void uProject (Cell &p, const Cell &bound, Dimension k) const
bool uNext (Cell &p, const Cell &lower, const Cell &upper) const
SCell sFirst (const SCell &p) const
SCell sLast (const SCell &p) const
SCell sGetIncr (const SCell &p, Dimension k) const
bool sIsMax (const SCell &p, Dimension k) const
bool sIsInside (const SCell &p, Dimension k) const
SCell sGetMax (const SCell &p, Dimension k) const
SCell sGetDecr (const SCell &p, Dimension k) const
bool sIsMin (const SCell &p, Dimension k) const
SCell sGetMin (const SCell &p, Dimension k) const
SCell sGetAdd (const SCell &p, Dimension k, const Integer &x) const
SCell sGetSub (const SCell &p, Dimension k, const Integer &x) const
Integer sDistanceToMax (const SCell &p, Dimension k) const
Integer sDistanceToMin (const SCell &p, Dimension k) const
SCell sTranslation (const SCell &p, const Vector &vec) const
SCell sProjection (const SCell &p, const SCell &bound, Dimension k) const
void sProject (SCell &p, const SCell &bound, Dimension k) const
bool sNext (SCell &p, const SCell &lower, const SCell &upper) const
Cells uNeighborhood (const Cell &cell) const
SCells sNeighborhood (const SCell &cell) const
Cells uProperNeighborhood (const Cell &cell) const
SCells sProperNeighborhood (const SCell &cell) const
Cell uAdjacent (const Cell &p, Dimension k, bool up) const
SCell sAdjacent (const SCell &p, Dimension k, bool up) const
Cell uIncident (const Cell &c, Dimension k, bool up) const
SCell sIncident (const SCell &c, Dimension k, bool up) const
Cells uLowerIncident (const Cell &c) const
Cells uUpperIncident (const Cell &c) const
SCells sLowerIncident (const SCell &c) const
SCells sUpperIncident (const SCell &c) const
Cells uFaces (const Cell &c) const
Cells uCoFaces (const Cell &c) const
bool sDirect (const SCell &p, Dimension k) const
SCell sDirectIncident (const SCell &p, Dimension k) const
SCell sIndirectIncident (const SCell &p, Dimension k) const
void selfDisplay (std::ostream &out) const
bool isValid () const

Static Public Attributes

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

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CCommutativeRing< TInteger >))

Private Attributes

Point myLower
Point myUpper
Cell myCellLower
Cell myCellUpper
bool myIsClosed

Detailed Description

template<Dimension dim, typename TInteger = DGtal::int32_t>
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'

The space is generally finite (except for arbitrary size integers). The user should choose between a closed (default) cell space or an open cell space.

Template Parameters:
dimthe dimension of the digital space.
TIntegerthe Integer class used to specify the arithmetic computations (default type = int32). NB: Essentially a backport from ImaGene.
Examples:
topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 358 of file KhalimskySpaceND.h.


Member Typedef Documentation

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

Definition at line 371 of file KhalimskySpaceND.h.

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

Definition at line 407 of file KhalimskySpaceND.h.

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

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

Definition at line 412 of file KhalimskySpaceND.h.

template<Dimension dim, typename TInteger = DGtal::int32_t>
typedef CellDirectionIterator< dim, Integer > DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator

Definition at line 375 of file KhalimskySpaceND.h.

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

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

Definition at line 365 of file KhalimskySpaceND.h.

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

Definition at line 382 of file KhalimskySpaceND.h.

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

Definition at line 378 of file KhalimskySpaceND.h.

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

Definition at line 372 of file KhalimskySpaceND.h.

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

Definition at line 408 of file KhalimskySpaceND.h.

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

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

Definition at line 414 of file KhalimskySpaceND.h.

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

Definition at line 374 of file KhalimskySpaceND.h.

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

Type used to represent sizes in the digital space.

Definition at line 368 of file KhalimskySpaceND.h.

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

Definition at line 381 of file KhalimskySpaceND.h.

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

Definition at line 373 of file KhalimskySpaceND.h.

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

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

Definition at line 416 of file KhalimskySpaceND.h.

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

Definition at line 379 of file KhalimskySpaceND.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 347 of file KhalimskySpaceND.ih.

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

Default onstructor.

Definition at line 354 of file KhalimskySpaceND.ih.

References DGtal::NumberTraits< T >::max(), and DGtal::NumberTraits< T >::min().

{
Point low, high;
for ( Dimension i = 0; i < dimension; ++i )
{
low[ i ] = NumberTraits< Integer >::min() / 2 + 1;
high[ i ] = NumberTraits< Integer >::max() / 2 - 1;
}
init( low, high, true );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::KhalimskySpaceND ( const KhalimskySpaceND< dim, TInteger > &  other)
inline

Copy constructor.

Parameters:
otherthe object to clone.

Definition at line 368 of file KhalimskySpaceND.ih.


Member Function Documentation

template<Dimension dim, typename TInteger = DGtal::int32_t>
DGtal::KhalimskySpaceND< dim, TInteger >::BOOST_CONCEPT_ASSERT ( (CCommutativeRing< TInteger >)  )
private
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::init ( const Point lower,
const Point upper,
bool  closed 
)
inline

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

Parameters:
lower_includedthe lowest point in this space (digital coords)
upper_includedthe upper point in this space (digital coords)
closed'true' if this space is closed, 'false' if open.
Returns:
true if the initialization was valid (ie, such bounds are representable with these integers).
Examples:
topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, topology/ctopo-2-3d.cpp, topology/ctopo-2.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 394 of file KhalimskySpaceND.ih.

References DGtal::BOUNDED.

{
myIsClosed = closed;
myLower = lower;
myUpper = upper;
{
for ( Dimension i = 0; i < dimension; ++i )
{
if ( ( lower[ i ]
|| ( upper[ i ]
return false;
}
}
for ( Dimension i = 0; i < dimension; ++i )
{
myCellLower.myCoordinates[ i ] = ( lower[ i ] * 2 )
+ ( closed ? 0 : 1 );
myCellUpper.myCoordinates[ i ] = ( upper[ i ] * 2 )
+ ( closed ? 2 : 1 );
}
return true;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isSpaceClosed ( ) const
inline
Returns:
'true' iff the space is closed.

Definition at line 490 of file KhalimskySpaceND.ih.

{
return myIsClosed;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 1695 of file KhalimskySpaceND.ih.

{
return true;
}
template<Dimension dim, typename TInteger >
const DGtal::KhalimskySpaceND< dim, TInteger >::Point & DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound ( ) const
inline
Returns:
the lower bound for digital points in this space.
Examples:
topology/ctopo-2.cpp.

Definition at line 454 of file KhalimskySpaceND.ih.

{
return myLower;
}
template<Dimension dim, typename TInteger >
const DGtal::KhalimskySpaceND< dim, TInteger >::Cell & DGtal::KhalimskySpaceND< dim, TInteger >::lowerCell ( ) const
inline
Returns:
the lower bound for cells in this space.

Definition at line 472 of file KhalimskySpaceND.ih.

{
return myCellLower;
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::max ( Dimension  k) const
inline
Parameters:
ka coordinate (from 0 to 'dim()-1').
Returns:
the maximal coordinate in the [k]-dimension.

Definition at line 445 of file KhalimskySpaceND.ih.

{
return myUpper[ k ];
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::min ( Dimension  k) const
inline
Parameters:
ka coordinate (from 0 to 'dim()-1').
Returns:
the minimal coordinate in the [k]-dimension.

Definition at line 436 of file KhalimskySpaceND.ih.

{
return myLower[ k ];
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger > & DGtal::KhalimskySpaceND< dim, TInteger >::operator= ( const KhalimskySpaceND< dim, TInteger > &  other)
inline
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sAdjacent ( const SCell p,
Dimension  k,
bool  up 
) const
inline

NB: you can go out of the space.

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 )'.

Definition at line 1441 of file KhalimskySpaceND.ih.

{
return up ? sGetIncr( p, k ) : sGetDecr( p, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sCell ( const Point kp,
Sign  sign = POS 
) const
inline

From the Khalimsky coordinates of a cell and a sign, builds the corresponding unsigned cell.

Parameters:
kpan integer point (Khalimsky coordinates of cell).
signthe sign of the cell (either POS or NEG).
Returns:
the unsigned cell.
Examples:
topology/ctopo-1s-3d.cpp.

Definition at line 521 of file KhalimskySpaceND.ih.

{
return SCell( kp, sign == POS );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sCell ( const Point p,
const SCell c 
) const
inline

From the digital coordinates of a point in Zn and a signed cell type, builds the corresponding signed cell.

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].

Definition at line 530 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates, and DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
SCell nc( p, c.myPositive );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ] + ( c.myCoordinates[ i ] & 0x1 );
return nc;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Integer DGtal::KhalimskySpaceND< dim, TInteger >::sCoord ( const SCell c,
Dimension  k 
) const
inline
Parameters:
cany signed cell.
kany valid dimension.
Returns:
its digital coordinate along [k].

Definition at line 643 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
return c.myCoordinates[ k ] >> 1;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Point DGtal::KhalimskySpaceND< dim, TInteger >::sCoords ( const SCell c) const
inline
Parameters:
cany signed cell.
Returns:
its digital coordinates.

Definition at line 662 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
Point dp;
for ( Dimension i = 0; i < DIM; ++i )
dp[ i ] = c.myCoordinates[ i ] >> 1;
return dp;
}
template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::sDim ( const SCell p) const
inline
Parameters:
pany signed cell.
Returns:
the dimension of the cell [p].

Definition at line 868 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
if ( p.myCoordinates[ k ] & NumberTraits<Integer>::ONE )
++i;
return i;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sDirect ( const SCell p,
Dimension  k 
) const
inline

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).

Definition at line 1621 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
ASSERT( k < dim );
bool sign = p.myPositive;
for ( Dimension i = 0; i <= k; ++i )
if ( sIsOpen( p, i ) )
sign = ! sign;
return sign;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sDirectIncident ( const SCell p,
Dimension  k 
) const
inline
Parameters:
pany signed cell.
kany coordinate.
Returns:
the direct incident cell of [p] along [k] (the incident cell along [k] whose sign is positive).

Definition at line 1635 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates, and DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
ASSERT( k < dim );
SCell d( p );
bool sign = d.myPositive;
for ( Dimension i = 0; i <= k; ++i )
if ( sIsOpen( d, i ) )
sign = ! sign;
bool up = sign;
d.myPositive = POS;
ASSERT( ( ! up ) || ( sKCoord( d, k ) < uKCoord( myCellUpper, k ) ) );
ASSERT( ( up ) || ( uKCoord( myCellLower, k ) < sKCoord( d, k ) ) );
if ( up ) ++d.myCoordinates[ k ];
else --d.myCoordinates[ k ];
return d;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::sDirs ( const SCell p) const
inline

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:

KSpace::SCell p;
...
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:
topology/ctopo-2-3d.cpp.

Definition at line 929 of file KhalimskySpaceND.ih.

{
return DirIterator( p, true );
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::sDistanceToMax ( const SCell p,
Dimension  k 
) const
inline

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

Parameters:
pany cell.
kthe coordinate that is tested.
Returns:
the number of increment to do to reach the maximum value.

Definition at line 1282 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return ( myCellUpper.myCoordinates[ k ] - p.myCoordinates[ k ] ) >> 1;
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::sDistanceToMin ( const SCell p,
Dimension  k 
) const
inline

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

Parameters:
pany cell.
kthe coordinate that is tested.
Returns:
the number of decrement to do to reach the minimum value.

Definition at line 1291 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return ( p.myCoordinates[ k ] - myCellLower.myCoordinates[ k ] ) >> 1;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 1686 of file KhalimskySpaceND.ih.

{
out << "[KhalimskySpaceND]";
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sFirst ( const SCell p) const
inline
Returns:
the first cell of the space with the same type as [p].

Definition at line 1172 of file KhalimskySpaceND.ih.

{
return sCell( myLower, p );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetAdd ( const SCell p,
Dimension  k,
const Integer x 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
xthe increment.
Returns:
the same element as [p] except for a coordinate [k] incremented with x.

Definition at line 1260 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
q.myCoordinates[ k ] += 2*x;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetDecr ( const SCell p,
Dimension  k 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
Returns:
the same element as [p] except for an decremented coordinate [k].

Definition at line 1230 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
q.myCoordinates[ k ] -= 2;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetIncr ( const SCell p,
Dimension  k 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
Returns:
the same element as [p] except for the incremented coordinate [k].

Definition at line 1190 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
q.myCoordinates[ k ] += 2;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetMax ( const SCell p,
Dimension  k 
) const
inline

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.

Definition at line 1220 of file KhalimskySpaceND.ih.

{
return sProjection( p, sLast(p), k );
// return sProjection( p, myCellUpper, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetMin ( const SCell p,
Dimension  k 
) const
inline

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.

Definition at line 1250 of file KhalimskySpaceND.ih.

{
return sProjection( p, sFirst(p), k );
// return sProjection( p, myCellLower, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sGetSub ( const SCell p,
Dimension  k,
const Integer x 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
xthe decrement.
Returns:
the same element as [p] except for a coordinate [k] decremented with x.

Definition at line 1271 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
q.myCoordinates[ k ] -= 2*x;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::signs ( const Cell p,
Sign  s 
) const
inline

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].

Definition at line 683 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return sCell( p.myCoordinates, s );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sIncident ( const SCell c,
Dimension  k,
bool  up 
) const
inline
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 [forward]. 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.
The cell should have an incident cell in this direction/orientation.

Definition at line 1467 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates, and DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
ASSERT( k < dim );
ASSERT( ( ! up ) || ( sKCoord( c, k ) < uKCoord( myCellUpper, k ) ) );
ASSERT( ( up ) || ( uKCoord( myCellLower, k ) < sKCoord( c, k ) ) );
SCell d( c );
bool sign = up ? d.myPositive : ! d.myPositive;
for ( Dimension i = 0; i <= k; ++i )
if ( sIsOpen( d, i ) )
sign = ! sign;
d.myPositive = sign;
if ( up ) ++d.myCoordinates[ k ];
else --d.myCoordinates[ k ];
return d;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sIndirectIncident ( const SCell p,
Dimension  k 
) const
inline
Parameters:
pany signed cell.
kany coordinate.
Returns:
the indirect incident cell of [p] along [k] (the incident cell along [k] whose sign is negative).

Definition at line 1658 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates, and DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
ASSERT( k < dim );
SCell d( p );
bool sign = d.myPositive;
for ( Dimension i = 0; i <= k; ++i )
if ( sIsOpen( d, i ) )
sign = ! sign;
bool up = ! sign;
d.myPositive = NEG;
ASSERT( ( ! up ) || ( sKCoord( d, k ) < uKCoord( myCellUpper, k ) ) );
ASSERT( ( up ) || ( uKCoord( myCellLower, k ) < sKCoord( d, k ) ) );
if ( up ) ++d.myCoordinates[ k ];
else --d.myCoordinates[ k ];
return d;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsInside ( const SCell p,
Dimension  k 
) const
inline

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.

Definition at line 1210 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return (p.myCoordinates[ k ] <= sLast(p).myCoordinates[ k ]) &&
(p.myCoordinates[ k ] >= sFirst(p).myCoordinates[ k ]);
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsMax ( const SCell p,
Dimension  k 
) const
inline

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.

Definition at line 1201 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] >= myCellUpper.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsMin ( const SCell p,
Dimension  k 
) const
inline

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.

Definition at line 1241 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] <= myCellLower.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsOpen ( const SCell p,
Dimension  k 
) const
inline
Parameters:
pany signed cell.
kany direction.
Returns:
'true' if [p] is open along the direction [k].

Definition at line 908 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] & NumberTraits<Integer>::ONE;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sIsSurfel ( const SCell b) const
inline
Parameters:
bany signed cell.
Returns:
'true' if [b] is a surfel (spans all but one coordinate).

Definition at line 890 of file KhalimskySpaceND.ih.

{
return sDim( b ) == ( DIM - 1 );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Size DGtal::KhalimskySpaceND< dim, TInteger >::size ( Dimension  k) const
inline
Parameters:
ka coordinate (from 0 to 'dim()-1').
Returns:
the width of the space in the [k]-dimension.

Definition at line 426 of file KhalimskySpaceND.ih.

{
ASSERT( k < dimension );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Integer DGtal::KhalimskySpaceND< dim, TInteger >::sKCoord ( const SCell c,
Dimension  k 
) const
inline
Parameters:
cany signed cell.
kany valid dimension.
Returns:
its Khalimsky coordinate along [k].

Definition at line 633 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
return c.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Point DGtal::KhalimskySpaceND< dim, TInteger >::sKCoords ( const SCell c) const
inline
Parameters:
cany signed cell.
Returns:
its Khalimsky coordinates.

Definition at line 653 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return c.myCoordinates;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sLast ( const SCell p) const
inline
Returns:
the last cell of the space with the same type as [p].

Definition at line 1181 of file KhalimskySpaceND.ih.

{
return sCell( myUpper, p );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCells DGtal::KhalimskySpaceND< dim, TInteger >::sLowerIncident ( const SCell c) const
inline
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.

Definition at line 1525 of file KhalimskySpaceND.ih.

{
SCells N;
for ( DirIterator q = sDirs( c ); q != 0; ++q )
{
Dimension k = *q;
Integer x = sKCoord( c, k );
if ( uKCoord( myCellLower, k ) < x )
N.push_back( sIncident( c, k, false ) );
if ( x < uKCoord( myCellUpper, k ) )
N.push_back( sIncident( c, k, true ) );
}
return N;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCells DGtal::KhalimskySpaceND< dim, TInteger >::sNeighborhood ( const SCell cell) const
inline

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].

Definition at line 1380 of file KhalimskySpaceND.ih.

{
SCells N;
N.push_back( c );
for ( Dimension k = 0; k < DIM; ++k )
{
if ( ! sIsMin( c, k ) )
N.push_back( sGetDecr( c, k ) );
if ( ! sIsMax( c, k ) )
N.push_back( sGetIncr( c, k ) );
}
return N;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::sNext ( SCell p,
const SCell lower,
const SCell upper 
) const
inline

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

KSpace K;
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.

Definition at line 1332 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
if ( sCoord( p, k ) == sCoord( upper, k ) )
{
if ( p == upper ) return false;
sProject( p, lower, k );
for ( k = 1; k < DIM; ++k )
{
if ( sCoord( p, k ) == sCoord( upper, k ) )
sProject( p, lower, k );
else
{
p.myCoordinates[ k ] += 2;
break;
}
}
return true;
}
p.myCoordinates[ k ] += 2;
return true;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sOpp ( const SCell p) const
inline

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

Parameters:
pany signed cell.
Returns:
the cell [p] with opposite sign.

Definition at line 701 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates, and DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
return sCell( p.myCoordinates, ! p.myPositive );
}
template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDir ( const SCell s) const
inline

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

Parameters:
sa signed surfel
Returns:
the orthogonal direction of [s]

Definition at line 967 of file KhalimskySpaceND.ih.

References DGtal::CellDirectionIterator< dim, TInteger >::end().

{
DirIterator it( s, false );
ASSERT( ! it.end() );
return *it;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::sOrthDirs ( const SCell p) const
inline

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:

KSpace::SCell p;
...
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.

Definition at line 947 of file KhalimskySpaceND.ih.

{
return DirIterator( p, false );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sPointel ( const Point p,
Sign  sign = POS 
) const
inline

From the digital coordinates of a point in Zn, creates the pointel (cell of dimension 0) with these coordinates.

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].
Examples:
topology/ctopo-1s-3d.cpp.

Definition at line 578 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell nc( p, sign );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ];
return nc;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sProject ( SCell p,
const SCell bound,
Dimension  k 
) const
inline

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.
Returns:
the projection.

Definition at line 1323 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
p.myCoordinates[ k ] = bound.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sProjection ( const SCell p,
const SCell bound,
Dimension  k 
) const
inline

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.

Definition at line 1312 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
q.myCoordinates[ k ] = bound.myCoordinates[ k ];
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCells DGtal::KhalimskySpaceND< dim, TInteger >::sProperNeighborhood ( const SCell cell) const
inline

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].

Definition at line 1415 of file KhalimskySpaceND.ih.

{
SCells N;
for ( Dimension k = 0; k < DIM; ++k )
{
if ( ! sIsMin( c, k ) )
N.push_back( sGetDecr( c, k ) );
if ( ! sIsMax( c, k ) )
N.push_back( sGetIncr( c, k ) );
}
return N;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetCoord ( SCell c,
Dimension  k,
Integer  i 
) const
inline

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

Parameters:
cany signed cell.
kany valid dimension.
ian integer coordinate within the space.

Definition at line 747 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
i = ( i << 1 ) + ( c.myCoordinates[ k ] & 1 );
ASSERT( myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetCoords ( SCell c,
const Point kp 
) const
inline

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

Parameters:
cany signed cell.
kpthe new Khalimsky coordinates for [c].

Definition at line 794 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
{
i = ( p[ k ] << 1 ) + ( c.myCoordinates[ k ] & 1 );
ASSERT( myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetKCoord ( SCell c,
Dimension  k,
const Integer i 
) const
inline

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

Parameters:
cany signed cell.
kany valid dimension.
ian integer coordinate within the space.

Definition at line 722 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM
&& myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetKCoords ( SCell c,
const Point kp 
) const
inline

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

Parameters:
cany signed cell.
kpthe new Khalimsky coordinates for [c].

Definition at line 769 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
c.myCoordinates = kp;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::sSetSign ( SCell c,
Sign  s 
) const
inline

Sets the sign of the cell.

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

Definition at line 810 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
c.myPositive = ( s == POS );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Sign DGtal::KhalimskySpaceND< dim, TInteger >::sSign ( const SCell c) const
inline
Parameters:
cany signed cell.
Returns:
its sign.

Definition at line 674 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myPositive.

{
return c.myPositive ? POS : NEG;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sSpel ( const Point p,
Sign  sign = POS 
) const
inline

From the digital coordinates of a point in Zn, creates the spel (cell of maximal dimension) with these coordinates.

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].

Definition at line 554 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell nc( p, sign );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ] + 1;
return nc;
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::sTopology ( const SCell p) const
inline
Parameters:
pany signed cell.
Returns:
the topology word of [p].

Definition at line 838 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
{
if ( p.myCoordinates[ k ] & NumberTraits<Integer>::ONE )
i |= j;
j <<= 1;
}
return i;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCell DGtal::KhalimskySpaceND< dim, TInteger >::sTranslation ( const SCell p,
const Vector vec 
) const
inline

Add the vector [vec] to [p]. NB: you can go out of the space.

Parameters:
pany cell.
vecany pointel.
Returns:
the signed code of the cell [p] translated by [coord].
Examples:
topology/ctopo-1s-3d.cpp.

Definition at line 1300 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
SCell q = p;
for ( Dimension k = 0; k < DIM; ++k )
q.myCoordinates[ k ] += ( vec[ k ] << 1 );
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::SCells DGtal::KhalimskySpaceND< dim, TInteger >::sUpperIncident ( const SCell c) const
inline
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.

Definition at line 1544 of file KhalimskySpaceND.ih.

{
SCells N;
for ( DirIterator q = sOrthDirs( c ); q != 0; ++q )
{
Dimension k = *q;
Integer x = sKCoord( c, k );
if ( uKCoord( myCellLower, k ) < x )
N.push_back( sIncident( c, k, false ) );
if ( x < uKCoord( myCellUpper, k ) )
N.push_back( sIncident( c, k, true ) );
}
return N;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uAdjacent ( const Cell p,
Dimension  k,
bool  up 
) const
inline

NB: you can go out of the space.

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 )'.

Definition at line 1432 of file KhalimskySpaceND.ih.

{
return up ? uGetIncr( p, k ) : uGetDecr( p, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uCell ( const Point kp) const
inline

From the Khalimsky coordinates of a cell, builds the corresponding unsigned cell.

Parameters:
kpan integer point (Khalimsky coordinates of cell).
Returns:
the unsigned cell.
Examples:
topology/ctopo-1-3d.cpp, and topology/ctopo-1.cpp.

Definition at line 500 of file KhalimskySpaceND.ih.

{
return Cell( kp );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uCell ( const Point p,
const Cell c 
) const
inline

From the digital coordinates of a point in Zn and a cell type, builds the corresponding cell.

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].

Definition at line 509 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell nc( p );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ] + ( c.myCoordinates[ i ] & 0x1 );
return nc;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uCoFaces ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
the proper cofaces of [c] (chain of upper incidence).

Definition at line 1592 of file KhalimskySpaceND.ih.

{
Dimension dim_of_c = uDim( c );
Cells N;
Cells P;
std::deque<Dimension> Q;
P.push_back( c );
Q.push_back( dimension - dim_of_c );
while ( ! P.empty() )
{
Cell d = P.front(); P.pop_front();
Dimension k = Q.front(); Q.pop_front();
if ( k != dim_of_c ) N.push_back( d );
// the use of k induces that incident faces are not duplicated.
for ( DirIterator q = uOrthDirs( d ); ( q != 0 ) && ( k > 0 ); ++q, --k )
{
P.push_back( uIncident( d, *q, false ) );
Q.push_back( k - 1 );
P.push_back( uIncident( d, *q, true ) );
Q.push_back( k - 1 );
}
}
return N;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Integer DGtal::KhalimskySpaceND< dim, TInteger >::uCoord ( const Cell c,
Dimension  k 
) const
inline
Parameters:
cany unsigned cell.
kany valid dimension.
Returns:
its digital coordinate along [k].

Definition at line 602 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
return c.myCoordinates[ k ] >> 1;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Point DGtal::KhalimskySpaceND< dim, TInteger >::uCoords ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
its digital coordinates.
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 621 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Point dp;
for ( Dimension i = 0; i < DIM; ++i )
dp[ i ] = c.myCoordinates[ i ] >> 1;
return dp;
}
template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::uDim ( const Cell p) const
inline
Parameters:
pany unsigned cell.
Returns:
the dimension of the cell [p].

Definition at line 855 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
if ( p.myCoordinates[ k ] & NumberTraits<Integer>::ONE )
++i;
return i;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::uDirs ( const Cell p) const
inline

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:

KSpace::Cell p;
...
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.

Definition at line 920 of file KhalimskySpaceND.ih.

{
return DirIterator( p, true );
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::uDistanceToMax ( const Cell p,
Dimension  k 
) const
inline

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

Parameters:
pany cell.
kthe coordinate that is tested.
Returns:
the number of increment to do to reach the maximum value.

Definition at line 1091 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return ( myCellUpper.myCoordinates[ k ] - p.myCoordinates[ k ] ) >> 1;
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::uDistanceToMin ( const Cell p,
Dimension  k 
) const
inline

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

Parameters:
pany cell.
kthe coordinate that is tested.
Returns:
the number of decrement to do to reach the minimum value.

Definition at line 1100 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return ( p.myCoordinates[ k ] - myCellLower.myCoordinates[ k ] ) >> 1;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uFaces ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
the proper faces of [c] (chain of lower incidence).

Definition at line 1563 of file KhalimskySpaceND.ih.

{
Dimension dim_of_c = uDim( c );
Cells N;
Cells P;
std::deque<Dimension> Q;
P.push_back( c );
Q.push_back( dim_of_c );
while ( ! P.empty() )
{
Cell d = P.front(); P.pop_front();
Dimension k = Q.front(); Q.pop_front();
if ( k != dim_of_c ) N.push_back( d );
// the use of k induces that incident faces are not duplicated.
for ( DirIterator q = uDirs( d ); ( q != 0 ) && ( k > 0 ); ++q, --k )
{
P.push_back( uIncident( d, *q, false ) );
Q.push_back( k - 1 );
P.push_back( uIncident( d, *q, true ) );
Q.push_back( k - 1 );
}
}
return N;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uFirst ( const Cell p) const
inline
Returns:
the first cell of the space with the same type as [p].
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 981 of file KhalimskySpaceND.ih.

{
return uCell( myLower, p );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetAdd ( const Cell p,
Dimension  k,
const Integer x 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
xthe increment.
Returns:
the same element as [p] except for a coordinate [k] incremented with x.

Definition at line 1069 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
q.myCoordinates[ k ] += 2*x;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetDecr ( const Cell p,
Dimension  k 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
Returns:
the same element as [p] except for an decremented coordinate [k].
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 1039 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
q.myCoordinates[ k ] -= 2;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetIncr ( const Cell p,
Dimension  k 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
Returns:
the same element as [p] except for the incremented coordinate [k].
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 999 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
q.myCoordinates[ k ] += 2;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetMax ( const Cell p,
Dimension  k 
) const
inline

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.
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 1029 of file KhalimskySpaceND.ih.

{
return uProjection( p, uLast(p), k );
// return uProjection( p, myCellUpper, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetMin ( const Cell p,
Dimension  k 
) const
inline

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.
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 1059 of file KhalimskySpaceND.ih.

{
return uProjection( p, uFirst(p), k );
//return uProjection( p, myCellLower, k );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uGetSub ( const Cell p,
Dimension  k,
const Integer x 
) const
inline

NB: you can go out of the space.

Parameters:
pany cell.
kthe coordinate that is changed.
xthe decrement.
Returns:
the same element as [p] except for a coordinate [k] decremented with x.

Definition at line 1080 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
q.myCoordinates[ k ] -= 2*x;
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uIncident ( const Cell c,
Dimension  k,
bool  up 
) const
inline
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 [forward].
Note:
It may be a lower incident cell if [c] is open along axis [k], else an upper incident cell.
The cell should have an incident cell in this direction/orientation.

Definition at line 1452 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < dim );
ASSERT( ( ! up ) || ( uKCoord( c, k ) < uKCoord( myCellUpper, k ) ) );
ASSERT( ( up ) || ( uKCoord( myCellLower, k ) < uKCoord( c, k ) ) );
Cell d( c );
if ( up ) ++d.myCoordinates[ k ];
else --d.myCoordinates[ k ];
return d;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsInside ( const Cell p,
Dimension  k 
) const
inline

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.
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 1019 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return (p.myCoordinates[ k ] <= uLast(p).myCoordinates[ k ]) &&
(p.myCoordinates[ k ] >= uFirst(p).myCoordinates[ k ]);
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsMax ( const Cell p,
Dimension  k 
) const
inline

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.

Definition at line 1010 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] >= myCellUpper.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsMin ( const Cell p,
Dimension  k 
) const
inline

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.

Definition at line 1050 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] <= myCellLower.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsOpen ( const Cell p,
Dimension  k 
) const
inline
Parameters:
pany cell.
kany direction.
Returns:
'true' if [p] is open along the direction [k].

Definition at line 899 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return p.myCoordinates[ k ] & NumberTraits<Integer>::ONE;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uIsSurfel ( const Cell b) const
inline
Parameters:
bany unsigned cell.
Returns:
'true' if [b] is a surfel (spans all but one coordinate).

Definition at line 881 of file KhalimskySpaceND.ih.

{
return uDim( b ) == ( DIM - 1 );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Integer DGtal::KhalimskySpaceND< dim, TInteger >::uKCoord ( const Cell c,
Dimension  k 
) const
inline
Parameters:
cany unsigned cell.
kany valid dimension.
Returns:
its Khalimsky coordinate along [k].

Definition at line 592 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
return c.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Point DGtal::KhalimskySpaceND< dim, TInteger >::uKCoords ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
its Khalimsky coordinates.

Definition at line 612 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
return c.myCoordinates;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uLast ( const Cell p) const
inline
Returns:
the last cell of the space with the same type as [p].
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 990 of file KhalimskySpaceND.ih.

{
return uCell( myUpper, p );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uLowerIncident ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
the cells directly low incident to c in this space.

Definition at line 1487 of file KhalimskySpaceND.ih.

{
Cells N;
for ( DirIterator q = uDirs( c ); q != 0; ++q )
{
Dimension k = *q;
Integer x = uKCoord( c, k );
if ( uKCoord( myCellLower, k ) < x )
N.push_back( uIncident( c, k, false ) );
if ( x < uKCoord( myCellUpper, k ) )
N.push_back( uIncident( c, k, true ) );
}
return N;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uNeighborhood ( const Cell cell) const
inline

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].

Definition at line 1362 of file KhalimskySpaceND.ih.

{
Cells N;
N.push_back( c );
for ( Dimension k = 0; k < DIM; ++k )
{
if ( ! uIsMin( c, k ) )
N.push_back( uGetDecr( c, k ) );
if ( ! uIsMax( c, k ) )
N.push_back( uGetIncr( c, k ) );
}
return N;
}
template<Dimension dim, typename TInteger >
bool DGtal::KhalimskySpaceND< dim, TInteger >::uNext ( Cell p,
const Cell lower,
const Cell upper 
) const
inline

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

KSpace K;
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.
Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 1141 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
if ( uCoord( p, k ) == uCoord( upper, k ) )
{
if ( p == upper ) return false;
uProject( p, lower, k );
for ( k = 1; k < DIM; ++k )
{
if ( uCoord( p, k ) == uCoord( upper, k ) )
uProject( p, lower, k );
else
{
p.myCoordinates[ k ] += 2;
break;
}
}
return true;
}
p.myCoordinates[ k ] += 2;
return true;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::unsigns ( const SCell p) const
inline

Creates an unsigned cell from a signed one.

Parameters:
pany signed cell.
Returns:
the unsigned version of the cell [p].

Definition at line 692 of file KhalimskySpaceND.ih.

References DGtal::SignedKhalimskyCell< dim, TInteger >::myCoordinates.

{
return uCell( p.myCoordinates );
}
template<Dimension dim, typename TInteger >
Dimension DGtal::KhalimskySpaceND< dim, TInteger >::uOrthDir ( const Cell s) const
inline

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]

Definition at line 956 of file KhalimskySpaceND.ih.

References DGtal::CellDirectionIterator< dim, TInteger >::end().

{
DirIterator it( s, false );
ASSERT( ! it.end() );
return *it;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::DirIterator DGtal::KhalimskySpaceND< dim, TInteger >::uOrthDirs ( const Cell p) const
inline

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:

KSpace::Cell p;
...
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.

Definition at line 938 of file KhalimskySpaceND.ih.

{
return DirIterator( p, false );
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uPointel ( const Point p) const
inline

From the digital coordinates of a point in Zn, creates the pointel (cell of dimension 0) with these coordinates.

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

Definition at line 566 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell nc( p );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ];
return nc;
}
template<Dimension dim, typename TInteger >
const DGtal::KhalimskySpaceND< dim, TInteger >::Point & DGtal::KhalimskySpaceND< dim, TInteger >::upperBound ( ) const
inline
Returns:
the upper bound for digital points in this space.
Examples:
topology/ctopo-2.cpp.

Definition at line 463 of file KhalimskySpaceND.ih.

{
return myUpper;
}
template<Dimension dim, typename TInteger >
const DGtal::KhalimskySpaceND< dim, TInteger >::Cell & DGtal::KhalimskySpaceND< dim, TInteger >::upperCell ( ) const
inline
Returns:
the upper bound for cells in this space.

Definition at line 481 of file KhalimskySpaceND.ih.

{
return myCellUpper;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uProject ( Cell p,
const Cell bound,
Dimension  k 
) const
inline

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.
Returns:
the projection.

Definition at line 1132 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
p.myCoordinates[ k ] = bound.myCoordinates[ k ];
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uProjection ( const Cell p,
const Cell bound,
Dimension  k 
) const
inline

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.

Definition at line 1121 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
q.myCoordinates[ k ] = bound.myCoordinates[ k ];
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uProperNeighborhood ( const Cell cell) const
inline

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].

Definition at line 1398 of file KhalimskySpaceND.ih.

{
Cells N;
for ( Dimension k = 0; k < DIM; ++k )
{
if ( ! uIsMin( c, k ) )
N.push_back( uGetDecr( c, k ) );
if ( ! uIsMax( c, k ) )
N.push_back( uGetIncr( c, k ) );
}
return N;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetCoord ( Cell c,
Dimension  k,
Integer  i 
) const
inline

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

Parameters:
cany unsigned cell.
kany valid dimension.
ian integer coordinate within the space.

Definition at line 734 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM );
i = ( i << 1 ) + ( c.myCoordinates[ k ] & 1 );
ASSERT( myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetCoords ( Cell c,
const Point kp 
) const
inline

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

Parameters:
cany unsigned cell.
kpthe new Khalimsky coordinates for [c].

Definition at line 778 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
{
i = ( p[ k ] << 1 ) + ( c.myCoordinates[ k ] & 1 );
ASSERT( myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetKCoord ( Cell c,
Dimension  k,
const Integer i 
) const
inline

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

Parameters:
cany unsigned cell.
kany valid dimension.
ian integer coordinate within the space.

Definition at line 710 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
ASSERT( k < DIM
&& myCellLower.myCoordinates[ k ] <= i
&& i <= myCellUpper.myCoordinates[ k ] );
c.myCoordinates[ k ] = i;
}
template<Dimension dim, typename TInteger >
void DGtal::KhalimskySpaceND< dim, TInteger >::uSetKCoords ( Cell c,
const Point kp 
) const
inline

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

Parameters:
cany unsigned cell.
kpthe new Khalimsky coordinates for [c].

Definition at line 760 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
c.myCoordinates = kp;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uSpel ( const Point p) const
inline

From the digital coordinates of a point in Zn, creates the spel (cell of maximal dimension) with these coordinates.

Parameters:
pan integer point (digital coordinates of cell).
Returns:
the spel having the given digital coordinates [p].
Examples:
topology/ctopo-1.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 542 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell nc( p );
for ( Dimension i = 0; i < DIM; ++i )
nc.myCoordinates[ i ] += p[ i ] + 1;
return nc;
}
template<Dimension dim, typename TInteger >
TInteger DGtal::KhalimskySpaceND< dim, TInteger >::uTopology ( const Cell p) const
inline
Parameters:
pany unsigned cell.
Returns:
the topology word of [p].

Definition at line 821 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
for ( Dimension k = 0; k < DIM; ++k )
{
if ( p.myCoordinates[ k ] & NumberTraits<Integer>::ONE )
i |= j;
j <<= 1;
}
return i;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cell DGtal::KhalimskySpaceND< dim, TInteger >::uTranslation ( const Cell p,
const Vector vec 
) const
inline

Add the vector [vec] to [p]. NB: you can go out of the space.

Parameters:
pany cell.
vecany pointel.
Returns:
the unsigned code of the cell [p] translated by [coord].
Examples:
topology/ctopo-1-3d.cpp, and topology/ctopo-1.cpp.

Definition at line 1109 of file KhalimskySpaceND.ih.

References DGtal::KhalimskyCell< dim, TInteger >::myCoordinates.

{
Cell q = p;
for ( Dimension k = 0; k < DIM; ++k )
q.myCoordinates[ k ] += ( vec[ k ] << 1 );
return q;
}
template<Dimension dim, typename TInteger >
DGtal::KhalimskySpaceND< dim, TInteger >::Cells DGtal::KhalimskySpaceND< dim, TInteger >::uUpperIncident ( const Cell c) const
inline
Parameters:
cany unsigned cell.
Returns:
the cells directly up incident to c in this space.

Definition at line 1506 of file KhalimskySpaceND.ih.

{
Cells N;
for ( DirIterator q = uOrthDirs( c ); q != 0; ++q )
{
Dimension k = *q;
Integer x = uKCoord( c, k );
if ( uKCoord( myCellLower, k ) < x )
N.push_back( uIncident( c, k, false ) );
if ( x < uKCoord( myCellUpper, k ) )
N.push_back( uIncident( c, k, true ) );
}
return N;
}

Field Documentation

template<Dimension dim, typename TInteger = DGtal::int32_t>
const Dimension DGtal::KhalimskySpaceND< dim, TInteger >::DIM = dim
static

Definition at line 393 of file KhalimskySpaceND.h.

template<Dimension dim, typename TInteger = DGtal::int32_t>
const Dimension DGtal::KhalimskySpaceND< dim, TInteger >::dimension = dim
static

Definition at line 392 of file KhalimskySpaceND.h.

template<Dimension dim, typename TInteger = DGtal::int32_t>
Cell DGtal::KhalimskySpaceND< dim, TInteger >::myCellLower
private
template<Dimension dim, typename TInteger = DGtal::int32_t>
Cell DGtal::KhalimskySpaceND< dim, TInteger >::myCellUpper
private
template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::KhalimskySpaceND< dim, TInteger >::myIsClosed
private
template<Dimension dim, typename TInteger = DGtal::int32_t>
Point DGtal::KhalimskySpaceND< dim, TInteger >::myLower
private
template<Dimension dim, typename TInteger = DGtal::int32_t>
Point DGtal::KhalimskySpaceND< dim, TInteger >::myUpper
private
template<Dimension dim, typename TInteger = DGtal::int32_t>
const DGtal::KhalimskySpaceND< dim, TInteger >::Sign DGtal::KhalimskySpaceND< dim, TInteger >::NEG = false
static

Definition at line 395 of file KhalimskySpaceND.h.

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

Definition at line 394 of file KhalimskySpaceND.h.


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