Blender V5.0
Functions0D.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
11
12#include <set>
13#include <vector>
14
15#include "Interface0D.h"
16
17#include "../geometry/Geom.h"
18
19#include "../python/Director.h"
20
22
23#include "../system/Exception.h"
24#include "../system/Precision.h"
25
26#include "MEM_guardedalloc.h"
27
28namespace Freestyle {
29
30class FEdge;
31class ViewEdge;
32class SShape;
33
34using namespace Geometry;
35
36//
37// UnaryFunction0D (base class for functions in 0D)
38//
40
58template<class T> class UnaryFunction0D {
59 public:
61 void *py_uf0D;
62
65
68 {
69 py_uf0D = nullptr;
70 }
71
73 virtual ~UnaryFunction0D() {}
74
76 virtual string getName() const
77 {
78 return "UnaryFunction0D";
79 }
80
86 /* FIXME move the implementation to Functions0D.cpp */
88 {
90 }
91
92 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction0D")
93};
94
95#ifdef SWIG
96%feature("director") UnaryFunction0D<void>;
97%feature("director") UnaryFunction0D<uint>;
98%feature("director") UnaryFunction0D<float>;
99%feature("director") UnaryFunction0D<double>;
100%feature("director") UnaryFunction0D<Vec2f>;
101%feature("director") UnaryFunction0D<Vec3f>;
102%feature("director") UnaryFunction0D<Id>;
103
104%template(UnaryFunction0DVoid) UnaryFunction0D<void>;
105%template(UnaryFunction0DUnsigned) UnaryFunction0D<uint>;
106%template(UnaryFunction0DFloat) UnaryFunction0D<float>;
107%template(UnaryFunction0DDouble) UnaryFunction0D<double>;
108%template(UnaryFunction0DVec2f) UnaryFunction0D<Vec2f>;
109%template(UnaryFunction0DVec3f) UnaryFunction0D<Vec3f>;
110%template(UnaryFunction0DId) UnaryFunction0D<Id>;
111%template(UnaryFunction0DViewShape) UnaryFunction0D<ViewShape*>;
112%template(UnaryFunction0DVectorViewShape) UnaryFunction0D<std::vector<ViewShape*> >;
113#endif // SWIG
114
115//
116// Functions definitions
117//
119class ViewShape;
120
121namespace Functions0D {
122
123// GetXF0D
125class GetXF0D : public UnaryFunction0D<double> {
126 public:
128 string getName() const
129 {
130 return "GetXF0D";
131 }
132
135 {
136 result = iter->getX();
137 return 0;
138 }
139};
140
141// GetYF0D
143class GetYF0D : public UnaryFunction0D<double> {
144 public:
146 string getName() const
147 {
148 return "GetYF0D";
149 }
150
153 {
154 result = iter->getY();
155 return 0;
156 }
157};
158
159// GetZF0D
161class GetZF0D : public UnaryFunction0D<double> {
162 public:
164 string getName() const
165 {
166 return "GetZF0D";
167 }
168
171 {
172 result = iter->getZ();
173 return 0;
174 }
175};
176
177// GetProjectedXF0D
179class GetProjectedXF0D : public UnaryFunction0D<double> {
180 public:
182 string getName() const
183 {
184 return "GetProjectedXF0D";
185 }
186
189 {
190 result = iter->getProjectedX();
191 return 0;
192 }
193};
194
195// GetProjectedYF0D
197class GetProjectedYF0D : public UnaryFunction0D<double> {
198 public:
200 string getName() const
201 {
202 return "GetProjectedYF0D";
203 }
204
207 {
208 result = iter->getProjectedY();
209 return 0;
210 }
211};
212
213// GetProjectedZF0D
215class GetProjectedZF0D : public UnaryFunction0D<double> {
216 public:
218 string getName() const
219 {
220 return "GetProjectedZF0D";
221 }
222
225 {
226 result = iter->getProjectedZ();
227 return 0;
228 }
229};
230
231// GetCurvilinearAbscissaF0D
234 public:
236 string getName() const
237 {
238 return "GetCurvilinearAbscissaF0D";
239 }
240
243 {
244 result = iter.t();
245 return 0;
246 }
247};
248
249// GetParameterF0D
251class GetParameterF0D : public UnaryFunction0D<float> {
252 public:
254 string getName() const
255 {
256 return "GetParameterF0D";
257 }
258
261 {
262 result = iter.u();
263 return 0;
264 }
265};
266
267// VertexOrientation2DF0D
273 public:
275 string getName() const
276 {
277 return "VertexOrientation2DF0D";
278 }
279
282};
283
284// VertexOrientation3DF0D
290 public:
292 string getName() const
293 {
294 return "VertexOrientation3DF0D";
295 }
296
299};
300
301// Curvature2DAngleF0D
306class Curvature2DAngleF0D : public UnaryFunction0D<double> {
307 public:
309 string getName() const
310 {
311 return "Curvature2DAngleF0D";
312 }
313
316};
317
318// ZDiscontinuity
324class ZDiscontinuityF0D : public UnaryFunction0D<double> {
325 public:
327 string getName() const
328 {
329 return "ZDiscontinuityF0D";
330 }
331
334};
335
336// Normal2DF0D
341class Normal2DF0D : public UnaryFunction0D<Vec2f> {
342 public:
344 string getName() const
345 {
346 return "Normal2DF0D";
347 }
348
351};
352
353// MaterialF0D
362class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
363 public:
365 string getName() const
366 {
367 return "MaterialF0D";
368 }
369
372};
373
374// ShapeIdF0D
382class ShapeIdF0D : public UnaryFunction0D<Id> {
383 public:
385 string getName() const
386 {
387 return "ShapeIdF0D";
388 }
389
392};
393
394// QiF0D
403 public:
405 string getName() const
406 {
407 return "QuantitativeInvisibilityF0D";
408 }
409
412};
413
414// CurveNatureF0D
416class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> {
417 public:
419 string getName() const
420 {
421 return "CurveNatureF0D";
422 }
423
426};
427
428// GetShapeF0D
430class GetShapeF0D : public UnaryFunction0D<ViewShape *> {
431 public:
433 string getName() const
434 {
435 return "GetShapeF0D";
436 }
437
440};
441
442// GetOccludersF0D
444class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> {
445 public:
447 string getName() const
448 {
449 return "GetOccludersF0D";
450 }
451
454};
455
456// GetOccludeeF0D
458class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> {
459 public:
461 string getName() const
462 {
463 return "GetOccludeeF0D";
464 }
465
468};
469
471
472// getFEdge
474
475// getFEdges
476void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2);
477
478// getViewEdges
479void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2);
480
481// getShapeF0D
483
484// getOccludersF0D
485void getOccludersF0D(Interface0DIterator &it, std::set<ViewShape *> &oOccluders);
486
487// getOccludeeF0D
489
490} // end of namespace Functions0D
491
492} /* namespace Freestyle */
unsigned int uint
int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator &if0D_it)
Definition Director.cpp:229
Singleton to manage exceptions.
Class used to handle materials.
Vectors and Matrices (useful type definitions).
Interface to 0D elements.
Read Guarded memory(de)allocation.
Define the float precision used in the program.
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
int operator()(Interface0DIterator &iter)
virtual real getProjectedX() const
virtual real getZ() const
virtual real getY() const
virtual real getProjectedZ() const
virtual real getX() const
virtual real getProjectedY() const
virtual string getName() const
Definition Functions0D.h:76
virtual int operator()(Interface0DIterator &iter)
Definition Functions0D.h:87
ViewShape * getShapeF0D(Interface0DIterator &it)
ViewShape * getOccludeeF0D(Interface0DIterator &it)
void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2)
FEdge * getFEdge(Interface0D &it1, Interface0D &it2)
void getOccludersF0D(Interface0DIterator &it, set< ViewShape * > &oOccluders)
void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2)
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20