DGtal
1.3.0
Loading...
Searching...
No Matches
src
DGtal
math
ScalarFunctors.h
1
17
#pragma once
18
31
#if defined(ScalarFunctors_RECURSES)
32
#error Recursive header files inclusion detected in ScalarFunctors.h
33
#else
// defined(ScalarFunctors_RECURSES)
35
#define ScalarFunctors_RECURSES
36
37
#if !defined ScalarFunctors_h
39
#define ScalarFunctors_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
46
47
namespace
DGtal
{
48
namespace
functors {
49
54
template
<
typename
TScalar>
55
struct
HatFunction
{
56
typedef
TScalar
Scalar
;
57
typedef
Scalar
argument_type
;
58
typedef
Scalar
value_type
;
59
60
Scalar
myV0
;
61
Scalar
myV0OverR
;
62
Scalar
myR
;
63
64
public
:
65
HatFunction
(
Scalar
v0,
Scalar
r )
66
:
myV0
( v0 ),
myV0OverR
( v0 / r ),
myR
( r ) {}
67
Scalar
operator()
(
Scalar
d )
const
68
{
// d >= 0
69
ASSERT( d >= 0.0 );
70
if
( d >=
myR
)
return
0.0;
71
return
myV0
-
myV0OverR
* d;
72
}
73
};
74
79
template
<
typename
TScalar>
80
struct
BallConstantFunction
{
81
typedef
TScalar
Scalar
;
82
typedef
Scalar
argument_type
;
83
typedef
Scalar
value_type
;
84
85
Scalar
myV0
;
86
Scalar
myR
;
87
88
public
:
89
BallConstantFunction
(
Scalar
v0,
Scalar
r )
90
:
myV0
( v0 ),
myR
( r ) {}
91
Scalar
operator()
(
Scalar
d )
const
92
{
// d >= 0
93
ASSERT( d >= 0.0 );
94
return
( d >
myR
) ? 0.0 :
myV0
;
95
}
96
};
97
98
99
}
// namespace functors
100
}
// namespace DGtal
101
102
104
// Includes inline functions.
105
#include "DGtal/math/ScalarFunctors.ih"
106
107
// //
109
110
#endif
// !defined ScalarFunctors_h
111
112
#undef ScalarFunctors_RECURSES
113
#endif
// else defined(ScalarFunctors_RECURSES)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition:
ClosedIntegerHalfPlane.h:49
DGtal::functors::BallConstantFunction
Definition:
ScalarFunctors.h:80
DGtal::functors::BallConstantFunction::myV0
Scalar myV0
Definition:
ScalarFunctors.h:85
DGtal::functors::BallConstantFunction::operator()
Scalar operator()(Scalar d) const
Definition:
ScalarFunctors.h:91
DGtal::functors::BallConstantFunction::argument_type
Scalar argument_type
Definition:
ScalarFunctors.h:82
DGtal::functors::BallConstantFunction::value_type
Scalar value_type
Definition:
ScalarFunctors.h:83
DGtal::functors::BallConstantFunction::Scalar
TScalar Scalar
Definition:
ScalarFunctors.h:81
DGtal::functors::BallConstantFunction::BallConstantFunction
BallConstantFunction(Scalar v0, Scalar r)
Definition:
ScalarFunctors.h:89
DGtal::functors::BallConstantFunction::myR
Scalar myR
Definition:
ScalarFunctors.h:86
DGtal::functors::HatFunction
Definition:
ScalarFunctors.h:55
DGtal::functors::HatFunction::HatFunction
HatFunction(Scalar v0, Scalar r)
Definition:
ScalarFunctors.h:65
DGtal::functors::HatFunction::operator()
Scalar operator()(Scalar d) const
Definition:
ScalarFunctors.h:67
DGtal::functors::HatFunction::Scalar
TScalar Scalar
Definition:
ScalarFunctors.h:56
DGtal::functors::HatFunction::myV0OverR
Scalar myV0OverR
Definition:
ScalarFunctors.h:61
DGtal::functors::HatFunction::myR
Scalar myR
Definition:
ScalarFunctors.h:62
DGtal::functors::HatFunction::myV0
Scalar myV0
Definition:
ScalarFunctors.h:60
DGtal::functors::HatFunction::argument_type
Scalar argument_type
Definition:
ScalarFunctors.h:57
DGtal::functors::HatFunction::value_type
Scalar value_type
Definition:
ScalarFunctors.h:58
Generated on Sun Nov 27 2022 15:15:49 for DGtal by
1.9.5