DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::functors::SCellToCode< KSpace > Class Template Reference

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

#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 KSpacemyK
 

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

◆ Input

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

Definition at line 561 of file SCellsFunctors.h.

◆ Output

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

Definition at line 559 of file SCellsFunctors.h.

◆ Point

Definition at line 557 of file SCellsFunctors.h.

◆ Vector

Definition at line 558 of file SCellsFunctors.h.

Constructor & Destructor Documentation

◆ SCellToCode() [1/3]

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

Default constructor.

Definition at line 574 of file SCellsFunctors.h.

574: myK(NULL) { }

◆ SCellToCode() [2/3]

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) { }

◆ SCellToCode() [3/3]

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

◆ BOOST_STATIC_ASSERT()

template<typename KSpace >
DGtal::functors::SCellToCode< KSpace >::BOOST_STATIC_ASSERT ( KSpace::dimension  = =2)
private

◆ operator()()

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 }
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.
const Point & sKCoords(const SCell &c) const
Return its Khalimsky coordinates.
MyPointD Point
Definition: testClone2.cpp:383
FreemanChain< int >::Vector Vector

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

◆ operator=()

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.

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

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

Field Documentation

◆ myK

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()(), and DGtal::functors::SCellToCode< KSpace >::operator=().


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