DGtal  1.4.2
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace > Class Template Reference

Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell. More...

#include <DGtal/geometry/surfaces/FunctorOnCells.h>

Public Types

typedef FunctorOnCells< TFunctorOnPoints, TKSpace > Self
 
typedef TFunctorOnPoints FunctorOnPoints
 
typedef TKSpace KSpace
 
typedef int Quantity
 
typedef FunctorOnPoints::Point Point
 
typedef FunctorOnPoints::Value Value
 
typedef KSpace::SCell Cell
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CPointFunctor< FunctorOnPoints >))
 
 FunctorOnCells (Alias< FunctorOnPoints > functor, ConstAlias< KSpace > kspace)
 
 FunctorOnCells (const FunctorOnCells &other)
 
 ~FunctorOnCells ()
 
Quantity operator() (const Cell &aCell) const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
FunctorOnCellsoperator= (const FunctorOnCells &other)
 
const KSpacespace () const
 

Protected Member Functions

 FunctorOnCells ()
 

Private Attributes

FunctorOnPointsf
 Const pointor on Functor on Points. Used on operator() to get the return value. More...
 
const KSpacemyKSpace
 Const pointor on Khalimsky Space. Used to convert Cell -> Point. More...
 

Detailed Description

template<typename TFunctorOnPoints, typename TKSpace>
class DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >

Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell.

Description of template class 'FunctorOnCells'

Template Parameters
TFunctorOnPointsa model of functor on Digital Points.
TKSpaceKhalimsky space in which the shape is defined.

Definition at line 70 of file FunctorOnCells.h.

Member Typedef Documentation

◆ Cell

template<typename TFunctorOnPoints , typename TKSpace >
typedef KSpace::SCell DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Cell

Definition at line 81 of file FunctorOnCells.h.

◆ FunctorOnPoints

template<typename TFunctorOnPoints , typename TKSpace >
typedef TFunctorOnPoints DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnPoints

Definition at line 76 of file FunctorOnCells.h.

◆ KSpace

template<typename TFunctorOnPoints , typename TKSpace >
typedef TKSpace DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::KSpace

Definition at line 77 of file FunctorOnCells.h.

◆ Point

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnPoints::Point DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Point

Definition at line 79 of file FunctorOnCells.h.

◆ Quantity

template<typename TFunctorOnPoints , typename TKSpace >
typedef int DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Quantity

Definition at line 78 of file FunctorOnCells.h.

◆ Self

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnCells<TFunctorOnPoints, TKSpace> DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Self

Definition at line 75 of file FunctorOnCells.h.

◆ Value

template<typename TFunctorOnPoints , typename TKSpace >
typedef FunctorOnPoints::Value DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::Value

Definition at line 80 of file FunctorOnCells.h.

Constructor & Destructor Documentation

◆ FunctorOnCells() [1/3]

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( Alias< FunctorOnPoints functor,
ConstAlias< KSpace kspace 
)
inline

Constructor.

Parameters
[in]functora functor on digital points.
[in]kspaceKhalimsky space in which the shape is defined.

Definition at line 92 of file FunctorOnCells.h.

93  : f(&functor),
94  myKSpace(&kspace)
95  {}
FunctorOnPoints * f
Const pointor on Functor on Points. Used on operator() to get the return value.
const KSpace * myKSpace
Const pointor on Khalimsky Space. Used to convert Cell -> Point.

◆ FunctorOnCells() [2/3]

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( const FunctorOnCells< TFunctorOnPoints, TKSpace > &  other)
inline

Copy constructor.

Parameters
otherthe object to clone.

Definition at line 101 of file FunctorOnCells.h.

102  : f( other.f ), myKSpace( other.myKSpace )
103  {}

◆ ~FunctorOnCells()

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::~FunctorOnCells ( )

Destructor.

◆ FunctorOnCells() [3/3]

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::FunctorOnCells ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT()

template<typename TFunctorOnPoints , typename TKSpace >
DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::BOOST_CONCEPT_ASSERT ( (concepts::CPointFunctor< FunctorOnPoints >)  )

◆ isValid()

template<typename TFunctorOnPoints , typename TKSpace >
bool DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ operator()()

template<typename TFunctorOnPoints , typename TKSpace >
Quantity DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator() ( const Cell aCell) const
inline

Call the functor on Point by converting the Cell to a Point.

Parameters
[in]aCellany cell in the Khalimsky space.
Returns
'ONE' if the point is inside the shape, 'ZERO' if it is strictly outside.

Definition at line 120 of file FunctorOnCells.h.

121  {
122  return ( f->operator()( myKSpace->sCoords(aCell) ) == NumberTraits< Value >::ZERO ) ? NumberTraits<Quantity>::ZERO : NumberTraits<Quantity>::ONE;
123  }
static const std::decay< T >::type ONE
Constant One.
Definition: NumberTraits.h:103
static const std::decay< T >::type ZERO
Constant Zero.
Definition: NumberTraits.h:100

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

◆ operator=()

template<typename TFunctorOnPoints , typename TKSpace >
FunctorOnCells& DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator= ( const FunctorOnCells< TFunctorOnPoints, TKSpace > &  other)
inline

Assignment.

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

Definition at line 142 of file FunctorOnCells.h.

143  {
144  if( this != &other )
145  {
146  f = other.f;
147  myKSpace = other.myKSpace;
148  }
149  return *this;
150  }

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::f, and DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

◆ selfDisplay()

template<typename TFunctorOnPoints , typename TKSpace >
void DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ space()

template<typename TFunctorOnPoints , typename TKSpace >
const KSpace& DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::space ( ) const
inline
Returns
the cellular grid space in which cells are defined.

Definition at line 155 of file FunctorOnCells.h.

156  {
157  return *myKSpace;
158  }

References DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace.

Field Documentation

◆ f

template<typename TFunctorOnPoints , typename TKSpace >
FunctorOnPoints* DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::f
private

Const pointor on Functor on Points. Used on operator() to get the return value.

Definition at line 165 of file FunctorOnCells.h.

Referenced by DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::operator=().

◆ myKSpace

template<typename TFunctorOnPoints , typename TKSpace >
const KSpace* DGtal::FunctorOnCells< TFunctorOnPoints, TKSpace >::myKSpace
private

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