Blender  V3.3
Functions0D.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include <set>
11 #include <vector>
12 
13 #include "Interface0D.h"
14 
15 #include "../geometry/Geom.h"
16 
17 #include "../python/Director.h"
18 
19 #include "../scene_graph/FrsMaterial.h"
20 
21 #include "../system/Exception.h"
22 #include "../system/Precision.h"
23 
24 #ifdef WITH_CXX_GUARDEDALLOC
25 # include "MEM_guardedalloc.h"
26 #endif
27 
28 namespace Freestyle {
29 
30 class FEdge;
31 class ViewEdge;
32 class SShape;
33 
34 using namespace Geometry;
35 
36 //
37 // UnaryFunction0D (base class for functions in 0D)
38 //
40 
58 template<class T> class UnaryFunction0D {
59  public:
61  void *py_uf0D;
62 
65 
68  {
69  py_uf0D = NULL;
70  }
71 
73  virtual ~UnaryFunction0D()
74  {
75  }
76 
78  virtual string getName() const
79  {
80  return "UnaryFunction0D";
81  }
82 
88  /* FIXME move the implementation to Functions0D.cpp */
89  virtual int operator()(Interface0DIterator &iter)
90  {
91  return Director_BPy_UnaryFunction0D___call__(this, py_uf0D, iter);
92  }
93 
94 #ifdef WITH_CXX_GUARDEDALLOC
95  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction0D")
96 #endif
97 };
98 
99 #ifdef SWIG
100 %feature("director") UnaryFunction0D<void>;
101 %feature("director") UnaryFunction0D<unsigned>;
102 %feature("director") UnaryFunction0D<float>;
103 %feature("director") UnaryFunction0D<double>;
104 %feature("director") UnaryFunction0D<Vec2f>;
105 %feature("director") UnaryFunction0D<Vec3f>;
106 %feature("director") UnaryFunction0D<Id>;
107 
108 %template(UnaryFunction0DVoid) UnaryFunction0D<void>;
109 %template(UnaryFunction0DUnsigned) UnaryFunction0D<unsigned>;
110 %template(UnaryFunction0DFloat) UnaryFunction0D<float>;
111 %template(UnaryFunction0DDouble) UnaryFunction0D<double>;
112 %template(UnaryFunction0DVec2f) UnaryFunction0D<Vec2f>;
113 %template(UnaryFunction0DVec3f) UnaryFunction0D<Vec3f>;
114 %template(UnaryFunction0DId) UnaryFunction0D<Id>;
115 %template(UnaryFunction0DViewShape) UnaryFunction0D<ViewShape*>;
116 %template(UnaryFunction0DVectorViewShape) UnaryFunction0D<std::vector<ViewShape*> >;
117 #endif // SWIG
118 
119 //
120 // Functions definitions
121 //
123 class ViewShape;
124 
125 namespace Functions0D {
126 
127 // GetXF0D
129 class GetXF0D : public UnaryFunction0D<double> {
130  public:
132  string getName() const
133  {
134  return "GetXF0D";
135  }
136 
139  {
140  result = iter->getX();
141  return 0;
142  }
143 };
144 
145 // GetYF0D
147 class GetYF0D : public UnaryFunction0D<double> {
148  public:
150  string getName() const
151  {
152  return "GetYF0D";
153  }
154 
157  {
158  result = iter->getY();
159  return 0;
160  }
161 };
162 
163 // GetZF0D
165 class GetZF0D : public UnaryFunction0D<double> {
166  public:
168  string getName() const
169  {
170  return "GetZF0D";
171  }
172 
175  {
176  result = iter->getZ();
177  return 0;
178  }
179 };
180 
181 // GetProjectedXF0D
183 class GetProjectedXF0D : public UnaryFunction0D<double> {
184  public:
186  string getName() const
187  {
188  return "GetProjectedXF0D";
189  }
190 
193  {
194  result = iter->getProjectedX();
195  return 0;
196  }
197 };
198 
199 // GetProjectedYF0D
201 class GetProjectedYF0D : public UnaryFunction0D<double> {
202  public:
204  string getName() const
205  {
206  return "GetProjectedYF0D";
207  }
208 
211  {
212  result = iter->getProjectedY();
213  return 0;
214  }
215 };
216 
217 // GetProjectedZF0D
219 class GetProjectedZF0D : public UnaryFunction0D<double> {
220  public:
222  string getName() const
223  {
224  return "GetProjectedZF0D";
225  }
226 
229  {
230  result = iter->getProjectedZ();
231  return 0;
232  }
233 };
234 
235 // GetCurvilinearAbscissaF0D
238  public:
240  string getName() const
241  {
242  return "GetCurvilinearAbscissaF0D";
243  }
244 
247  {
248  result = iter.t();
249  return 0;
250  }
251 };
252 
253 // GetParameterF0D
255 class GetParameterF0D : public UnaryFunction0D<float> {
256  public:
258  string getName() const
259  {
260  return "GetParameterF0D";
261  }
262 
265  {
266  result = iter.u();
267  return 0;
268  }
269 };
270 
271 // VertexOrientation2DF0D
277  public:
279  string getName() const
280  {
281  return "VertexOrientation2DF0D";
282  }
283 
285  int operator()(Interface0DIterator &iter);
286 };
287 
288 // VertexOrientation3DF0D
294  public:
296  string getName() const
297  {
298  return "VertexOrientation3DF0D";
299  }
300 
302  int operator()(Interface0DIterator &iter);
303 };
304 
305 // Curvature2DAngleF0D
310 class Curvature2DAngleF0D : public UnaryFunction0D<double> {
311  public:
313  string getName() const
314  {
315  return "Curvature2DAngleF0D";
316  }
317 
319  int operator()(Interface0DIterator &iter);
320 };
321 
322 // ZDiscontinuity
328 class ZDiscontinuityF0D : public UnaryFunction0D<double> {
329  public:
331  string getName() const
332  {
333  return "ZDiscontinuityF0D";
334  }
335 
337  int operator()(Interface0DIterator &iter);
338 };
339 
340 // Normal2DF0D
345 class Normal2DF0D : public UnaryFunction0D<Vec2f> {
346  public:
348  string getName() const
349  {
350  return "Normal2DF0D";
351  }
352 
354  int operator()(Interface0DIterator &iter);
355 };
356 
357 // MaterialF0D
366 class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
367  public:
369  string getName() const
370  {
371  return "MaterialF0D";
372  }
373 
375  int operator()(Interface0DIterator &iter);
376 };
377 
378 // ShapeIdF0D
386 class ShapeIdF0D : public UnaryFunction0D<Id> {
387  public:
389  string getName() const
390  {
391  return "ShapeIdF0D";
392  }
393 
395  int operator()(Interface0DIterator &iter);
396 };
397 
398 // QiF0D
406 class QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> {
407  public:
409  string getName() const
410  {
411  return "QuantitativeInvisibilityF0D";
412  }
413 
415  int operator()(Interface0DIterator &iter);
416 };
417 
418 // CurveNatureF0D
420 class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> {
421  public:
423  string getName() const
424  {
425  return "CurveNatureF0D";
426  }
427 
429  int operator()(Interface0DIterator &iter);
430 };
431 
432 // GetShapeF0D
434 class GetShapeF0D : public UnaryFunction0D<ViewShape *> {
435  public:
437  string getName() const
438  {
439  return "GetShapeF0D";
440  }
441 
443  int operator()(Interface0DIterator &iter);
444 };
445 
446 // GetOccludersF0D
448 class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> {
449  public:
451  string getName() const
452  {
453  return "GetOccludersF0D";
454  }
455 
457  int operator()(Interface0DIterator &iter);
458 };
459 
460 // GetOccludeeF0D
462 class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> {
463  public:
465  string getName() const
466  {
467  return "GetOccludeeF0D";
468  }
469 
471  int operator()(Interface0DIterator &iter);
472 };
473 
475 
476 // getFEdge
478 
479 // getFEdges
480 void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2);
481 
482 // getViewEdges
483 void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2);
484 
485 // getShapeF0D
487 
488 // getOccludersF0D
489 void getOccludersF0D(Interface0DIterator &it, std::set<ViewShape *> &oOccluders);
490 
491 // getOccludeeF0D
493 
494 } // end of namespace Functions0D
495 
496 } /* namespace Freestyle */
int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator &if0D_it)
Definition: Director.cpp:225
Interface to 0D elts.
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
SIMD_FORCE_INLINE btVector3 operator()(const btVector3 &x) const
Return the transform of the vector.
Definition: btTransform.h:90
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:246
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:264
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:192
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:210
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:228
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:138
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:156
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:174
virtual real getProjectedX() const
Definition: Interface0D.cpp:41
virtual real getZ() const
Definition: Interface0D.cpp:29
virtual real getY() const
Definition: Interface0D.cpp:23
virtual real getProjectedZ() const
Definition: Interface0D.cpp:53
virtual real getX() const
Definition: Interface0D.cpp:17
virtual real getProjectedY() const
Definition: Interface0D.cpp:47
virtual string getName() const
Definition: Functions0D.h:78
virtual int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:89
#define T
ViewShape * getShapeF0D(Interface0DIterator &it)
Definition: Functions0D.cpp:93
void getOccludersF0D(Interface0DIterator &it, std::set< ViewShape * > &oOccluders)
ViewShape * getOccludeeF0D(Interface0DIterator &it)
void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2)
Definition: Functions0D.cpp:23
FEdge * getFEdge(Interface0D &it1, Interface0D &it2)
Definition: Functions0D.cpp:18
void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2)
Definition: Functions0D.cpp:77
VecMat::Vec2< float > Vec2f
Definition: Geom.h:20
inherits from class Rep
Definition: AppCanvas.cpp:18