DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
FunctorOnCells.h
1
16
17
#pragma once
18
33
34
#if defined(FunctorOnCells_RECURSES)
35
#error Recursive header files inclusion detected in FunctorOnCells.h
36
#else
// defined(FunctorOnCells_RECURSES)
38
#define FunctorOnCells_RECURSES
39
40
#if !defined FunctorOnCells_h
42
#define FunctorOnCells_h
43
45
// Inclusions
46
#include <iostream>
47
#include "DGtal/base/Common.h"
48
#include "DGtal/base/Alias.h"
49
#include "DGtal/base/ConstAlias.h"
50
51
#include "DGtal/kernel/CSpace.h"
52
#include "DGtal/kernel/CPointFunctor.h"
53
55
56
namespace
DGtal
57
{
58
60
// template class FunctorOnCells
69
template
<
typename
TFunctorOnPo
int
s,
typename
TKSpace>
70
class
FunctorOnCells
71
{
72
// ----------------------- Standard services ------------------------------
73
public
:
74
75
typedef
FunctorOnCells<TFunctorOnPoints, TKSpace>
Self
;
76
typedef
TFunctorOnPoints
FunctorOnPoints
;
77
typedef
TKSpace
KSpace
;
78
typedef
int
Quantity
;
79
typedef
typename
FunctorOnPoints::Point
Point
;
80
typedef
typename
FunctorOnPoints::Value
Value
;
81
typedef
typename
KSpace::SCell
Cell
;
82
83
BOOST_CONCEPT_ASSERT
((
concepts::CPointFunctor< FunctorOnPoints >
));
84
//BOOST_CONCEPT_ASSERT(( CSpace< KSpace > ));
85
92
FunctorOnCells
(
Alias< FunctorOnPoints >
functor,
ConstAlias< KSpace >
kspace )
93
:
f
(&functor),
94
myKSpace
(&kspace)
95
{}
96
101
FunctorOnCells
(
const
FunctorOnCells
& other )
102
:
f
( other.
f
),
myKSpace
( other.
myKSpace
)
103
{}
104
108
~FunctorOnCells
();
109
110
111
// ----------------------- Interface --------------------------------------
112
public
:
120
Quantity
operator()
(
const
Cell
& aCell )
const
121
{
122
return
(
f
->operator()(
myKSpace
->sCoords(aCell) ) ==
NumberTraits< Value >::ZERO
) ?
NumberTraits<Quantity>::ZERO
:
NumberTraits<Quantity>::ONE
;
123
}
124
129
void
selfDisplay
( std::ostream & out )
const
;
130
135
bool
isValid
()
const
;
136
142
FunctorOnCells
&
operator=
(
const
FunctorOnCells
& other )
143
{
144
if
(
this
!= &other )
145
{
146
f
= other.
f
;
147
myKSpace
= other.
myKSpace
;
148
}
149
return
*
this
;
150
}
151
155
const
KSpace
&
space
()
const
156
{
157
return
*
myKSpace
;
158
}
159
160
// ------------------------- Protected Data ------------------------------
161
private
:
162
// ------------------------- Private Data --------------------------------
163
private
:
165
FunctorOnPoints
*
f
;
166
168
const
KSpace
*
myKSpace
;
169
170
// ------------------------- Hidden services ------------------------------
171
protected
:
172
177
FunctorOnCells
();
178
179
private
:
180
181
// ------------------------- Internals ------------------------------------
182
private
:
183
184
};
// end of class FunctorOnCells
185
186
193
template
<
typename
TF,
typename
TKS>
194
std::ostream&
195
operator<<
( std::ostream & out,
const
FunctorOnCells<TF, TKS>
&
object
);
196
197
}
// namespace DGtal
198
199
201
// Includes inline functions.
202
#include "DGtal/geometry/surfaces/FunctorOnCells.ih"
203
204
// //
206
207
#endif
// !defined FunctorOnCells_h
208
209
#undef FunctorOnCells_RECURSES
210
#endif
// else defined(FunctorOnCells_RECURSES)
DGtal::Alias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition
Alias.h:183
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition
ConstAlias.h:187
DGtal::FunctorOnCells
Aim: Convert a functor on Digital Point to a Functor on Khalimsky Cell.
Definition
FunctorOnCells.h:71
DGtal::FunctorOnCells::FunctorOnCells
FunctorOnCells(const FunctorOnCells &other)
Definition
FunctorOnCells.h:101
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::KSpace
KSpace KSpace
Definition
FunctorOnCells.h:77
DGtal::FunctorOnCells::FunctorOnCells
FunctorOnCells()
DGtal::FunctorOnCells::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPointFunctor< FunctorOnPoints >))
DGtal::FunctorOnCells::operator=
FunctorOnCells & operator=(const FunctorOnCells &other)
Definition
FunctorOnCells.h:142
DGtal::FunctorOnCells::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::Value
FunctorOnPoints::Value Value
Definition
FunctorOnCells.h:80
DGtal::FunctorOnCells::space
const KSpace & space() const
Definition
FunctorOnCells.h:155
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::Point
FunctorOnPoints::Point Point
Definition
FunctorOnCells.h:79
DGtal::FunctorOnCells::FunctorOnCells
FunctorOnCells(Alias< FunctorOnPoints > functor, ConstAlias< KSpace > kspace)
Definition
FunctorOnCells.h:92
DGtal::FunctorOnCells::operator()
Quantity operator()(const Cell &aCell) const
Definition
FunctorOnCells.h:120
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::f
FunctorOnPoints * f
Definition
FunctorOnCells.h:165
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::FunctorOnPoints
ShapePointFunctor FunctorOnPoints
Definition
FunctorOnCells.h:76
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::Quantity
int Quantity
Definition
FunctorOnCells.h:78
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::Self
FunctorOnCells< ShapePointFunctor, KSpace > Self
Definition
FunctorOnCells.h:75
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::myKSpace
const KSpace * myKSpace
Definition
FunctorOnCells.h:168
DGtal::FunctorOnCells< ShapePointFunctor, KSpace >::Cell
KSpace::SCell Cell
Definition
FunctorOnCells.h:81
DGtal::FunctorOnCells::isValid
bool isValid() const
DGtal::FunctorOnCells::~FunctorOnCells
~FunctorOnCells()
DGtal::KhalimskySpaceND< 3, Integer >::SCell
SignedKhalimskyCell< dim, Integer > SCell
Definition
KhalimskySpaceND.h:417
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::NumberTraitsImpl< std::decay< T >::type >::ONE
static const T ONE
Definition
NumberTraits.h:103
DGtal::NumberTraitsImpl< std::decay< T >::type >::ZERO
static const T ZERO
Definition
NumberTraits.h:100
DGtal::concepts::CPointFunctor
Aim: Defines a functor on points.
Definition
CPointFunctor.h:89
src
DGtal
geometry
surfaces
FunctorOnCells.h
Generated on
for DGtal by
1.18.0