Blender  V2.93
AdvancedFunctions1D.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "AdvancedFunctions0D.h"
25 
26 #include "../view_map/Functions1D.h"
27 
28 //
29 // Functions definitions
30 //
32 
33 namespace Freestyle {
34 
35 namespace Functions1D {
36 
37 // DensityF1D
43 class DensityF1D : public UnaryFunction1D<double> {
44  private:
45  float _sampling;
46 
47  public:
58  DensityF1D(double sigma = 2, IntegrationType iType = MEAN, float sampling = 2.0f)
59  : UnaryFunction1D<double>(iType), _fun(sigma)
60  {
61  _sampling = sampling;
62  }
63 
65  virtual ~DensityF1D()
66  {
67  }
68 
70  string getName() const
71  {
72  return "DensityF1D";
73  }
74 
76  int operator()(Interface1D &inter)
77  {
78  result = integrate(
79  _fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
80  return 0;
81  }
82 
83  private:
85 };
86 
87 // LocalAverageDepthF1D
93 class LocalAverageDepthF1D : public UnaryFunction1D<double> {
94  public:
102  : UnaryFunction1D<double>(iType), _fun(sigma)
103  {
104  }
105 
107  string getName() const
108  {
109  return "LocalAverageDepthF1D";
110  }
111 
114  {
115  result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
116  return 0;
117  }
118 
119  private:
121 };
122 
123 // GetCompleteViewMapDensity
130  public:
144  GetCompleteViewMapDensityF1D(unsigned level, IntegrationType iType = MEAN, float sampling = 2.0f)
145  : UnaryFunction1D<double>(iType), _fun(level)
146  {
147  _sampling = sampling;
148  }
149 
151  string getName() const
152  {
153  return "GetCompleteViewMapDensityF1D";
154  }
155 
157  int operator()(Interface1D &inter);
158 
159  private:
161  float _sampling;
162 };
163 
164 // GetDirectionalViewMapDensity
172  public:
185  GetDirectionalViewMapDensityF1D(unsigned iOrientation,
186  unsigned level,
187  IntegrationType iType = MEAN,
188  float sampling = 2.0f)
189  : UnaryFunction1D<double>(iType), _fun(iOrientation, level)
190  {
191  _sampling = sampling;
192  }
193 
195  string getName() const
196  {
197  return "GetDirectionalViewMapDensityF1D";
198  }
199 
201  int operator()(Interface1D &inter);
202 
203  private:
205  float _sampling;
206 };
207 
208 // GetSteerableViewMapDensityF1D
213  private:
214  int _level;
215  float _sampling;
216 
217  public:
228  GetSteerableViewMapDensityF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f)
229  : UnaryFunction1D<double>(iType)
230  {
231  _level = level;
232  _sampling = sampling;
233  }
234 
237  {
238  }
239 
241  string getName() const
242  {
243  return "GetSteerableViewMapDensityF1D";
244  }
245 
247  int operator()(Interface1D &inter);
248 };
249 
250 // GetViewMapGradientNormF1D
255  private:
256  int _level;
257  float _sampling;
259 
260  public:
271  GetViewMapGradientNormF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f)
272  : UnaryFunction1D<double>(iType), _func(level)
273  {
274  _level = level;
275  _sampling = sampling;
276  }
277 
279  string getName() const
280  {
281  return "GetViewMapGradientNormF1D";
282  }
283 
285  int operator()(Interface1D &inter);
286 };
287 
288 } // end of namespace Functions1D
289 
290 } /* namespace Freestyle */
Functions taking 0D input.
typedef double(DMatrix)[4][4]
DensityF1D(double sigma=2, IntegrationType iType=MEAN, float sampling=2.0f)
GetCompleteViewMapDensityF1D(unsigned level, IntegrationType iType=MEAN, float sampling=2.0f)
GetDirectionalViewMapDensityF1D(unsigned iOrientation, unsigned level, IntegrationType iType=MEAN, float sampling=2.0f)
GetSteerableViewMapDensityF1D(int level, IntegrationType iType=MEAN, float sampling=2.0f)
GetViewMapGradientNormF1D(int level, IntegrationType iType=MEAN, float sampling=2.0f)
LocalAverageDepthF1D(real sigma, IntegrationType iType=MEAN)
virtual Interface0DIterator verticesEnd()
Definition: Interface1D.cpp:35
virtual Interface0DIterator pointsEnd(float t=0.0f)
Definition: Interface1D.cpp:47
virtual Interface0DIterator verticesBegin()
Definition: Interface1D.cpp:29
virtual Interface0DIterator pointsBegin(float t=0.0f)
Definition: Interface1D.cpp:41
inherits from class Rep
Definition: AppCanvas.cpp:32
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
Definition: Interface1D.h:72
double real
Definition: Precision.h:26