DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::SCellToCode< KSpace > Class Template Reference

#include <SCellsFunctors.h>

Public Types

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

Public Member Functions

 SCellToCode ()
 SCellToCode (const 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::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 538 of file SCellsFunctors.h.


Member Typedef Documentation

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

Definition at line 549 of file SCellsFunctors.h.

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

Definition at line 547 of file SCellsFunctors.h.

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

Definition at line 545 of file SCellsFunctors.h.

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

Definition at line 546 of file SCellsFunctors.h.


Constructor & Destructor Documentation

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

Default constructor.

Definition at line 562 of file SCellsFunctors.h.

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

Constructor.

Parameters:
aKa Khalimsky space

Definition at line 567 of file SCellsFunctors.h.

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

Copy constructor.

Parameters:
otherany SCellToCode modifier

Definition at line 573 of file SCellsFunctors.h.

: myK(other.myK) { }

Member Function Documentation

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

Return a code from a linel

Parameters:
sa linel
Returns:
the corresponding code

Definition at line 595 of file SCellsFunctors.h.

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

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

Assignment.

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

Definition at line 581 of file SCellsFunctors.h.

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

{
if (this != &other)
{
myK = other.myK;
}
return *this;
}

Field Documentation

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

Aliasing pointer on the Khalimsky space.

Definition at line 555 of file SCellsFunctors.h.

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


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