DGtal  1.5.beta
DGtal::functors::SCellToPoint< KSpace > Class Template Reference

Aim: transforms a scell into a point. More...

#include <DGtal/topology/SCellsFunctors.h>

Public Types

typedef KSpace::Point Output
 
typedef KSpace::SCell Input
 

Public Member Functions

 SCellToPoint ()
 
 SCellToPoint (ConstAlias< KSpace > aK)
 
 SCellToPoint (const SCellToPoint &other)
 
SCellToPointoperator= (const SCellToPoint &other)
 
Output operator() (const Input &aSCell) const
 

Private Attributes

const KSpacemyK
 

Detailed Description

template<typename KSpace>
class DGtal::functors::SCellToPoint< KSpace >

Aim: transforms a scell into a point.

Description of template class 'SCellToPoint'

Template Parameters
KSpacethe Khalimsky space
KSpace aKSpace;
typename KSpace::SCell aSCell;
SCellToPoint<KSpace> f(aKSpace);
...
aPoint = f(aSCell);
Z3i::SCell SCell
MyPointD Point
Definition: testClone2.cpp:383
const Point aPoint(3, 4)
See also
ConstIteratorAdapter KhalimskySpaceND PointVector

Definition at line 74 of file SCellsFunctors.h.

Member Typedef Documentation

◆ Input

template<typename KSpace >
typedef KSpace::SCell DGtal::functors::SCellToPoint< KSpace >::Input

Definition at line 78 of file SCellsFunctors.h.

◆ Output

template<typename KSpace >
typedef KSpace::Point DGtal::functors::SCellToPoint< KSpace >::Output

Definition at line 77 of file SCellsFunctors.h.

Constructor & Destructor Documentation

◆ SCellToPoint() [1/3]

template<typename KSpace >
DGtal::functors::SCellToPoint< KSpace >::SCellToPoint ( )
inline

Default constructor.

Definition at line 91 of file SCellsFunctors.h.

91 : myK(NULL) { }

◆ SCellToPoint() [2/3]

template<typename KSpace >
DGtal::functors::SCellToPoint< KSpace >::SCellToPoint ( ConstAlias< KSpace aK)
inline

Constructor.

Parameters
aKa Khalimsky space

Definition at line 96 of file SCellsFunctors.h.

96 : myK(&aK) { }

◆ SCellToPoint() [3/3]

template<typename KSpace >
DGtal::functors::SCellToPoint< KSpace >::SCellToPoint ( const SCellToPoint< KSpace > &  other)
inline

Copy constructor.

Parameters
otherany SCellToPoint functor

Definition at line 102 of file SCellsFunctors.h.

103  : myK(other.myK) { }

Member Function Documentation

◆ operator()()

template<typename KSpace >
Output DGtal::functors::SCellToPoint< KSpace >::operator() ( const Input aSCell) const
inline

Returns a point (with integer coordinates) from a scell (with khalimsky coordinates)

Parameters
aSCella scell
Returns
the corresponding point.

Definition at line 126 of file SCellsFunctors.h.

127  {
128  ASSERT( myK );
129  Input s = aSCell;
130  while ( myK->sDim(s) > 0 )
131  {
132  Input tmp( myK->sIndirectIncident( s, *myK->sDirs( s ) ) );
133  ASSERT( myK->sDim(tmp) < myK->sDim(s) );
134  s = tmp;
135  }
136  return Output( myK->sCoords(s) );
137  }
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...
DirIterator sDirs(const SCell &p) const
Given a signed cell [p], returns an iterator to iterate over each coordinate the cell spans.
Point sCoords(const SCell &c) const
Return its digital coordinates.
Dimension sDim(const SCell &p) const
Return the dimension of the cell [p].

References DGtal::functors::SCellToPoint< KSpace >::myK, DGtal::KhalimskySpaceND< dim, TInteger >::sCoords(), DGtal::KhalimskySpaceND< dim, TInteger >::sDim(), DGtal::KhalimskySpaceND< dim, TInteger >::sDirs(), and DGtal::KhalimskySpaceND< dim, TInteger >::sIndirectIncident().

◆ operator=()

template<typename KSpace >
SCellToPoint& DGtal::functors::SCellToPoint< KSpace >::operator= ( const SCellToPoint< KSpace > &  other)
inline

Assignment.

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

Definition at line 111 of file SCellsFunctors.h.

112  {
113  if (this != &other)
114  {
115  myK = other.myK;
116  }
117  return *this;
118  }

References DGtal::functors::SCellToPoint< KSpace >::myK.

Field Documentation

◆ myK

template<typename KSpace >
const KSpace* DGtal::functors::SCellToPoint< KSpace >::myK
private

Aliasing pointer on the Khalimsky space.

Definition at line 84 of file SCellsFunctors.h.

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


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