DGtal  0.9.4beta
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::functors::SCellToCode< KSpace > Class Template Reference

#include <DGtal/topology/SCellsFunctors.h>

Public Types

typedef KSpace::Point Point
 
typedef KSpace::Vector Vector
 
typedef char Output
 
typedef KSpace::SCell Input
 

Public Member Functions

 SCellToCode ()
 
 SCellToCode (ConstAlias< KSpace > aK)
 
 SCellToCode (const SCellToCode &other)
 
SCellToCodeoperator= (const SCellToCode &other)
 
Output operator() (const Input &s) const
 

Private Member Functions

 BOOST_STATIC_ASSERT (KSpace::dimension==2)
 

Private Attributes

const KSpace * myK
 

Detailed Description

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

Aim: transforms a 2d signed cell, basically a linel, into a code (0,1,2 or 3),.

Description of template class 'SCellToCode'

Template Parameters
KSpacethe 2d Khalimsky space
See also
ConstIteratorAdapter KhalimskySpaceND

Definition at line 550 of file SCellsFunctors.h.

Member Typedef Documentation

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

Definition at line 561 of file SCellsFunctors.h.

template<typename KSpace>
typedef char DGtal::functors::SCellToCode< KSpace >::Output

Definition at line 559 of file SCellsFunctors.h.

template<typename KSpace>
typedef KSpace::Point DGtal::functors::SCellToCode< KSpace >::Point

Definition at line 557 of file SCellsFunctors.h.

template<typename KSpace>
typedef KSpace::Vector DGtal::functors::SCellToCode< KSpace >::Vector

Definition at line 558 of file SCellsFunctors.h.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 574 of file SCellsFunctors.h.

574 : myK(NULL) { }
template<typename KSpace>
DGtal::functors::SCellToCode< KSpace >::SCellToCode ( ConstAlias< KSpace >  aK)
inline

Constructor.

Parameters
aKa Khalimsky space

Definition at line 579 of file SCellsFunctors.h.

579 : myK(&aK) { }
template<typename KSpace>
DGtal::functors::SCellToCode< KSpace >::SCellToCode ( const SCellToCode< KSpace > &  other)
inline

Copy constructor.

Parameters
otherany SCellToCode modifier

Definition at line 585 of file SCellsFunctors.h.

586  : myK(other.myK) { }

Member Function Documentation

template<typename KSpace>
DGtal::functors::SCellToCode< KSpace >::BOOST_STATIC_ASSERT ( KSpace::dimension  = =2)
private
template<typename KSpace>
Output DGtal::functors::SCellToCode< KSpace >::operator() ( const Input s) const
inline

Return a code from a linel

Parameters
sa linel
Returns
the corresponding code

Definition at line 607 of file SCellsFunctors.h.

608  {
609  ASSERT( myK );
610  //starting point of the arrow
611  Input pointel( myK->sIndirectIncident( s, *myK->sDirs( s ) ) );
612  Point p( myK->sCoords( pointel ) ); //integer coordinates
613  //displacement vector
614  Vector v( myK->sKCoords( s ) - myK->sKCoords( pointel ) );
615  if (v == Vector(1,0)) return '0';
616  else if (v == Vector(0,1)) return '1';
617  else if (v == Vector(-1,0)) return '2';
618  else if (v == Vector(0,-1)) return '3';
619  else return 'e'; //e for error!
620  }
template<typename KSpace>
SCellToCode& DGtal::functors::SCellToCode< KSpace >::operator= ( const SCellToCode< KSpace > &  other)
inline

Assignment.

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

Definition at line 593 of file SCellsFunctors.h.

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

594  {
595  if (this != &other)
596  {
597  myK = other.myK;
598  }
599  return *this;
600  }

Field Documentation

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

Aliasing pointer on the Khalimsky space.

Definition at line 567 of file SCellsFunctors.h.

Referenced by DGtal::functors::SCellToCode< KSpace >::operator=().


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