DGtal 1.4.0
Loading...
Searching...
No Matches
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
47namespace DGtal {
48 namespace functors {
49
54 template <typename TScalar>
55 struct HatFunction {
56 typedef TScalar Scalar;
59
63
64 public:
66 : myV0( v0 ), myV0OverR( v0 / r ), myR( r ) {}
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>
81 typedef TScalar Scalar;
84
87
88 public:
90 : myV0( v0 ), myR( r ) {}
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 is the top-level namespace which contains all DGtal functions and types.
BallConstantFunction(Scalar v0, Scalar r)
HatFunction(Scalar v0, Scalar r)
Scalar operator()(Scalar d) const