DGtal 2.0.0
Loading...
Searching...
No Matches
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 461 of file SCellsFunctors.h.

Member Typedef Documentation

◆ Input

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

Definition at line 472 of file SCellsFunctors.h.

◆ Output

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

Definition at line 470 of file SCellsFunctors.h.

◆ Point

Definition at line 468 of file SCellsFunctors.h.

◆ Vector

Definition at line 469 of file SCellsFunctors.h.

Constructor & Destructor Documentation

◆ SCellToCode() [1/3]

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

Default constructor.

Definition at line 485 of file SCellsFunctors.h.

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

References myK.

Referenced by operator=(), and SCellToCode().

◆ SCellToCode() [2/3]

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

Constructor.

Parameters
aKa Khalimsky space

Definition at line 490 of file SCellsFunctors.h.

490: myK(&aK) { }

References myK.

◆ 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 496 of file SCellsFunctors.h.

497 : myK(other.myK) { }

References myK, and SCellToCode().

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 518 of file SCellsFunctors.h.

519 {
520 ASSERT( myK );
521 //starting point of the arrow
522 Input pointel( myK->sIndirectIncident( s, *myK->sDirs( s ) ) );
523 Point p( myK->sCoords( pointel ) ); //integer coordinates
524 //displacement vector
525 Vector v( myK->sKCoords( s ) - myK->sKCoords( pointel ) );
526 if (v == Vector(1,0)) return '0';
527 else if (v == Vector(0,1)) return '1';
528 else if (v == Vector(-1,0)) return '2';
529 else if (v == Vector(0,-1)) return '3';
530 else return 'e'; //e for error!
531 }

References myK.

◆ 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 504 of file SCellsFunctors.h.

505 {
506 if (this != &other)
507 {
508 myK = other.myK;
509 }
510 return *this;
511 }

References myK, and SCellToCode().

Field Documentation

◆ myK

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

Aliasing pointer on the Khalimsky space.

Definition at line 478 of file SCellsFunctors.h.

Referenced by operator()(), operator=(), SCellToCode(), SCellToCode(), and SCellToCode().


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