DGtal  1.5.beta
DGtal::PreCellDirectionIterator< dim, TInteger > Class Template Reference

This class is useful for looping on all "interesting" coordinates of a pre-cell. More...

#include <DGtal/topology/KhalimskyPreSpaceND.h>

Public Types

typedef TInteger Integer
 
typedef KhalimskyPreCell< dim, IntegerCell
 
typedef SignedKhalimskyPreCell< dim, IntegerSCell
 

Public Member Functions

 PreCellDirectionIterator (Cell cell, bool open=true)
 Constructor from a pre-cell. More...
 
 PreCellDirectionIterator (SCell scell, bool open=true)
 Constructor from a signed pre-cell. More...
 
Dimension operator* () const
 Return the current direction. More...
 
PreCellDirectionIteratoroperator++ ()
 Pre-increment. Go to next direction. More...
 
bool operator!= (const Integer) const
 Fast comparison with unsigned integer (unused parameter). More...
 
bool end () const
 Return 'true' if the iteration is ended. More...
 
bool operator!= (const PreCellDirectionIterator &other) const
 Slow comparison with other iterator. Useful to check for end of loop. More...
 
bool operator== (const PreCellDirectionIterator &other) const
 Slow comparison with other iterator. More...
 

Private Member Functions

void find ()
 Look for next valid coordinate. More...
 

Private Attributes

Dimension myDir
 the current direction. More...
 
Cell myCell
 the cell. More...
 
bool myOpen
 If 'true', returns open coordinates, otherwise returns closed coordinates. More...
 

Detailed Description

template<Dimension dim, typename TInteger = DGtal::int32_t>
class DGtal::PreCellDirectionIterator< dim, TInteger >

This class is useful for looping on all "interesting" coordinates of a pre-cell.

For instance, surfels in Z3 have two interesting coordinates (the ones spanned by the surfel).

KPreSpace::DirIterator q;
for ( q = KPreSpace::uDirs( p ); q != 0; ++q )
{
KPreSpace::Dimension dir = *q;
...
}
KSpace::Cell Cell

Definition at line 280 of file KhalimskyPreSpaceND.h.

Member Typedef Documentation

◆ Cell

template<Dimension dim, typename TInteger = DGtal::int32_t>
typedef KhalimskyPreCell< dim, Integer > DGtal::PreCellDirectionIterator< dim, TInteger >::Cell

Definition at line 285 of file KhalimskyPreSpaceND.h.

◆ Integer

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

Definition at line 283 of file KhalimskyPreSpaceND.h.

◆ SCell

template<Dimension dim, typename TInteger = DGtal::int32_t>
typedef SignedKhalimskyPreCell< dim, Integer > DGtal::PreCellDirectionIterator< dim, TInteger >::SCell

Definition at line 286 of file KhalimskyPreSpaceND.h.

Constructor & Destructor Documentation

◆ PreCellDirectionIterator() [1/2]

template<Dimension dim, typename TInteger = DGtal::int32_t>
DGtal::PreCellDirectionIterator< dim, TInteger >::PreCellDirectionIterator ( Cell  cell,
bool  open = true 
)
explicit

Constructor from a pre-cell.

Parameters
cellany unsigned pre-cell
open'true' if the cell if open.

◆ PreCellDirectionIterator() [2/2]

template<Dimension dim, typename TInteger = DGtal::int32_t>
DGtal::PreCellDirectionIterator< dim, TInteger >::PreCellDirectionIterator ( SCell  scell,
bool  open = true 
)
explicit

Constructor from a signed pre-cell.

Parameters
scellany signed pre-cell
open'true' if the cell if open.

Member Function Documentation

◆ end()

template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::PreCellDirectionIterator< dim, TInteger >::end ( ) const

Return 'true' if the iteration is ended.

Returns
'true' if the iteration is ended.

◆ find()

template<Dimension dim, typename TInteger = DGtal::int32_t>
void DGtal::PreCellDirectionIterator< dim, TInteger >::find ( )
private

Look for next valid coordinate.

◆ operator!=() [1/2]

template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::PreCellDirectionIterator< dim, TInteger >::operator!= ( const  Integer) const

Fast comparison with unsigned integer (unused parameter).

Comparison is 'false' at the end of the iteration.

Returns
'true' if the iterator is finished.

◆ operator!=() [2/2]

template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::PreCellDirectionIterator< dim, TInteger >::operator!= ( const PreCellDirectionIterator< dim, TInteger > &  other) const

Slow comparison with other iterator. Useful to check for end of loop.

Parameters
otherany direction iterator.

◆ operator*()

template<Dimension dim, typename TInteger = DGtal::int32_t>
Dimension DGtal::PreCellDirectionIterator< dim, TInteger >::operator* ( ) const

Return the current direction.

Returns
the current direction.

◆ operator++()

template<Dimension dim, typename TInteger = DGtal::int32_t>
PreCellDirectionIterator& DGtal::PreCellDirectionIterator< dim, TInteger >::operator++ ( )

Pre-increment. Go to next direction.

◆ operator==()

template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::PreCellDirectionIterator< dim, TInteger >::operator== ( const PreCellDirectionIterator< dim, TInteger > &  other) const

Slow comparison with other iterator.

Parameters
otherany direction iterator.

Field Documentation

◆ myCell

template<Dimension dim, typename TInteger = DGtal::int32_t>
Cell DGtal::PreCellDirectionIterator< dim, TInteger >::myCell
private

the cell.

Definition at line 343 of file KhalimskyPreSpaceND.h.

◆ myDir

template<Dimension dim, typename TInteger = DGtal::int32_t>
Dimension DGtal::PreCellDirectionIterator< dim, TInteger >::myDir
private

the current direction.

Definition at line 341 of file KhalimskyPreSpaceND.h.

◆ myOpen

template<Dimension dim, typename TInteger = DGtal::int32_t>
bool DGtal::PreCellDirectionIterator< dim, TInteger >::myOpen
private

If 'true', returns open coordinates, otherwise returns closed coordinates.

Definition at line 347 of file KhalimskyPreSpaceND.h.


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