Blender  V3.3
Functions1D.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include "Functions0D.h"
11 #include "Interface1D.h"
12 #include "ViewMap.h"
13 
14 #include "../system/FreestyleConfig.h"
15 #include "../system/Precision.h"
16 #include "../system/TimeStamp.h"
17 
18 #include "../python/Director.h"
19 
20 #ifdef WITH_CXX_GUARDEDALLOC
21 # include "MEM_guardedalloc.h"
22 #endif
23 
24 namespace Freestyle {
25 
26 //
27 // UnaryFunction1D (base class for functions in 1D)
28 //
30 
45 template<class T> class UnaryFunction1D {
46  public:
48  void *py_uf1D;
49 
52 
55  {
57  }
58 
66  {
67  _integration = iType;
68  }
69 
71  virtual ~UnaryFunction1D()
72  {
73  }
74 
76  virtual string getName() const
77  {
78  return "UnaryFunction1D";
79  }
80 
86  /* FIXME move the implementation to Functions1D.cpp */
87  virtual int operator()(Interface1D &inter)
88  {
90  }
91 
94  {
95  _integration = integration;
96  }
97 
100  {
101  return _integration;
102  }
103 
104  protected:
106 
107 #ifdef WITH_CXX_GUARDEDALLOC
108  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D")
109 #endif
110 };
111 
113  public:
114  void *py_uf1D;
115 
117  {
118  _integration = MEAN;
119  }
120 
122  {
123  _integration = iType;
124  }
125 
127  {
128  }
129 
130  virtual string getName() const
131  {
132  return "UnaryFunction1D_void";
133  }
134 
135  /* FIXME move the implementation to Functions1D.cpp */
137  {
138  return Director_BPy_UnaryFunction1D___call__(this, py_uf1D, inter);
139  }
140 
142  {
143  _integration = integration;
144  }
145 
147  {
148  return _integration;
149  }
150 
151  protected:
153 
154 #ifdef WITH_CXX_GUARDEDALLOC
155  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D_void")
156 #endif
157 };
158 
159 //
160 // Functions definitions
161 //
163 
164 namespace Functions1D {
165 
166 // GetXF1D
168 class GetXF1D : public UnaryFunction1D<double> {
169  private:
170  Functions0D::GetXF0D _func;
171 
172  public:
178  {
179  }
180 
182  string getName() const
183  {
184  return "GetXF1D";
185  }
186 
188  int operator()(Interface1D &inter);
189 };
190 
191 // GetYF1D
193 class GetYF1D : public UnaryFunction1D<double> {
194  private:
195  Functions0D::GetYF0D _func;
196 
197  public:
203  {
204  }
205 
207  string getName() const
208  {
209  return "GetYF1D";
210  }
211 
213  int operator()(Interface1D &inter);
214 };
215 
216 // GetZF1D
218 class GetZF1D : public UnaryFunction1D<double> {
219  private:
220  Functions0D::GetZF0D _func;
221 
222  public:
228  {
229  }
230 
232  string getName() const
233  {
234  return "GetZF1D";
235  }
236 
238  int operator()(Interface1D &inter);
239 };
240 
241 // GetProjectedXF1D
243 class GetProjectedXF1D : public UnaryFunction1D<double> {
244  private:
246 
247  public:
253  {
254  }
255 
257  string getName() const
258  {
259  return "GetProjectedXF1D";
260  }
261 
263  int operator()(Interface1D &inter);
264 };
265 
266 // GetProjectedYF1D
268 class GetProjectedYF1D : public UnaryFunction1D<double> {
269  private:
271 
272  public:
278  {
279  }
280 
282  string getName() const
283  {
284  return "GetProjectedYF1D";
285  }
286 
288  int operator()(Interface1D &inter);
289 };
290 
291 // GetProjectedZF1D
293 class GetProjectedZF1D : public UnaryFunction1D<double> {
294  private:
296 
297  public:
303  {
304  }
305 
307  string getName() const
308  {
309  return "GetProjectedZF1D";
310  }
311 
313  int operator()(Interface1D &inter);
314 };
315 
316 // Orientation2DF1D
318 class Orientation2DF1D : public UnaryFunction1D<Vec2f> {
319  private:
321 
322  public:
328  {
329  }
330 
332  string getName() const
333  {
334  return "Orientation2DF1D";
335  }
336 
338  int operator()(Interface1D &inter);
339 };
340 
341 // Orientation3DF1D
343 class Orientation3DF1D : public UnaryFunction1D<Vec3f> {
344  private:
346 
347  public:
353  {
354  }
355 
357  string getName() const
358  {
359  return "Orientation3DF1D";
360  }
361 
363  int operator()(Interface1D &inter);
364 };
365 
366 // ZDiscontinuityF1D
372 class ZDiscontinuityF1D : public UnaryFunction1D<double> {
373  private:
375 
376  public:
382  {
383  }
384 
386  string getName() const
387  {
388  return "ZDiscontinuityF1D";
389  }
390 
392  int operator()(Interface1D &inter);
393 };
394 
395 // QuantitativeInvisibilityF1D
402  private:
404 
405  public:
411  {
412  }
413 
415  string getName() const
416  {
417  return "QuantitativeInvisibilityF1D";
418  }
419 
421  int operator()(Interface1D &inter);
422 };
423 
424 // CurveNatureF1D
431 class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> {
432  private:
434 
435  public:
441  {
442  }
443 
445  string getName() const
446  {
447  return "CurveNatureF1D";
448  }
449 
451  int operator()(Interface1D &inter);
452 };
453 
454 // TimeStampF1D
457  public:
459  string getName() const
460  {
461  return "TimeStampF1D";
462  }
463 
465  int operator()(Interface1D &inter);
466 };
467 
468 // IncrementChainingTimeStampF1D
471  public:
473  string getName() const
474  {
475  return "IncrementChainingTimeStampF1D";
476  }
477 
479  int operator()(Interface1D &inter);
480 };
481 
482 // ChainingTimeStampF1D
485  public:
487  string getName() const
488  {
489  return "ChainingTimeStampF1D";
490  }
491 
493  int operator()(Interface1D &inter);
494 };
495 
496 // Curvature2DAngleF1D
498 class Curvature2DAngleF1D : public UnaryFunction1D<double> {
499  public:
505  {
506  }
507 
509  string getName() const
510  {
511  return "Curvature2DAngleF1D";
512  }
513 
516  {
517  result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
518  return 0;
519  }
520 
521  private:
523 };
524 
525 // Normal2DF1D
527 class Normal2DF1D : public UnaryFunction1D<Vec2f> {
528  public:
534  {
535  }
536 
538  string getName() const
539  {
540  return "Normal2DF1D";
541  }
542 
545  {
546  result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
547  return 0;
548  }
549 
550  private:
552 };
553 
554 // GetShapeF1D
556 class GetShapeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
557  public:
560  {
561  }
562 
564  string getName() const
565  {
566  return "GetShapeF1D";
567  }
568 
570  int operator()(Interface1D &inter);
571 };
572 
573 // GetOccludersF1D
575 class GetOccludersF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
576  public:
579  {
580  }
581 
583  string getName() const
584  {
585  return "GetOccludersF1D";
586  }
587 
589  int operator()(Interface1D &inter);
590 };
591 
592 // GetOccludeeF1D
594 class GetOccludeeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
595  public:
598  {
599  }
600 
602  string getName() const
603  {
604  return "GetOccludeeF1D";
605  }
606 
608  int operator()(Interface1D &inter);
609 };
610 
611 // internal
613 
614 // getOccludeeF1D
615 void getOccludeeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
616 
617 // getOccludersF1D
618 void getOccludersF1D(Interface1D &inter, set<ViewShape *> &oShapes);
619 
620 // getShapeF1D
621 void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
622 
623 } // end of namespace Functions1D
624 
625 } /* namespace Freestyle */
typedef double(DMatrix)[4][4]
int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D &if1D)
Definition: Director.cpp:289
Functions taking 0D input.
Interface 1D and related tools definitions.
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
Classes to define a View Map (ViewVertex, ViewEdge, etc.)
Curvature2DAngleF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:504
CurveNatureF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:440
int operator()(Interface1D &inter)
Definition: Functions1D.cpp:91
int operator()(Interface1D &inter)
GetProjectedXF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:252
GetProjectedYF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:277
GetProjectedZF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:302
int operator()(Interface1D &inter)
int operator()(Interface1D &inter)
Definition: Functions1D.cpp:14
GetXF1D(IntegrationType iType)
Definition: Functions1D.h:177
int operator()(Interface1D &inter)
Definition: Functions1D.cpp:20
GetYF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:202
int operator()(Interface1D &inter)
Definition: Functions1D.cpp:26
GetZF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:227
Normal2DF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:533
int operator()(Interface1D &inter)
Definition: Functions1D.h:544
Orientation2DF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:327
Orientation3DF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:352
QuantitativeInvisibilityF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:410
int operator()(Interface1D &inter)
ZDiscontinuityF1D(IntegrationType iType=MEAN)
Definition: Functions1D.h:381
virtual Interface0DIterator verticesEnd()
Definition: Interface1D.cpp:21
virtual Interface0DIterator verticesBegin()
Definition: Interface1D.cpp:15
void setIntegrationType(IntegrationType integration)
Definition: Functions1D.h:141
UnaryFunction1D_void(IntegrationType iType)
Definition: Functions1D.h:121
IntegrationType getIntegrationType() const
Definition: Functions1D.h:146
virtual string getName() const
Definition: Functions1D.h:130
int operator()(Interface1D &inter)
Definition: Functions1D.h:136
virtual string getName() const
Definition: Functions1D.h:76
virtual int operator()(Interface1D &inter)
Definition: Functions1D.h:87
IntegrationType getIntegrationType() const
Definition: Functions1D.h:99
void setIntegrationType(IntegrationType integration)
Definition: Functions1D.h:93
IntegrationType _integration
Definition: Functions1D.h:105
UnaryFunction1D(IntegrationType iType)
Definition: Functions1D.h:65
#define T
void getOccludeeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getShapeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getOccludersF1D(Interface1D &inter, set< ViewShape * > &oShapes)
unsigned short EdgeNature
Definition: Nature.h:32
inherits from class Rep
Definition: AppCanvas.cpp:18
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
Definition: Interface1D.h:73