Blender V4.3
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
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#ifdef WITH_CXX_GUARDEDALLOC
27# include "MEM_guardedalloc.h"
28#endif
29
30namespace Freestyle {
31
32class FEdge;
33class ViewEdge;
34class SShape;
35
36using namespace Geometry;
37
38//
39// UnaryFunction0D (base class for functions in 0D)
40//
42
60template<class T> class UnaryFunction0D {
61 public:
63 void *py_uf0D;
64
67
70 {
71 py_uf0D = nullptr;
72 }
73
75 virtual ~UnaryFunction0D() {}
76
78 virtual string getName() const
79 {
80 return "UnaryFunction0D";
81 }
82
88 /* FIXME move the implementation to Functions0D.cpp */
90 {
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<uint>;
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<uint>;
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//
123class ViewShape;
124
125namespace Functions0D {
126
127// GetXF0D
129class 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
147class 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
165class 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
183class 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
201class 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
219class 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
255class 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
286};
287
288// VertexOrientation3DF0D
294 public:
296 string getName() const
297 {
298 return "VertexOrientation3DF0D";
299 }
300
303};
304
305// Curvature2DAngleF0D
310class Curvature2DAngleF0D : public UnaryFunction0D<double> {
311 public:
313 string getName() const
314 {
315 return "Curvature2DAngleF0D";
316 }
317
320};
321
322// ZDiscontinuity
328class ZDiscontinuityF0D : public UnaryFunction0D<double> {
329 public:
331 string getName() const
332 {
333 return "ZDiscontinuityF0D";
334 }
335
338};
339
340// Normal2DF0D
345class Normal2DF0D : public UnaryFunction0D<Vec2f> {
346 public:
348 string getName() const
349 {
350 return "Normal2DF0D";
351 }
352
355};
356
357// MaterialF0D
366class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
367 public:
369 string getName() const
370 {
371 return "MaterialF0D";
372 }
373
376};
377
378// ShapeIdF0D
386class ShapeIdF0D : public UnaryFunction0D<Id> {
387 public:
389 string getName() const
390 {
391 return "ShapeIdF0D";
392 }
393
396};
397
398// QiF0D
407 public:
409 string getName() const
410 {
411 return "QuantitativeInvisibilityF0D";
412 }
413
416};
417
418// CurveNatureF0D
420class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> {
421 public:
423 string getName() const
424 {
425 return "CurveNatureF0D";
426 }
427
430};
431
432// GetShapeF0D
434class GetShapeF0D : public UnaryFunction0D<ViewShape *> {
435 public:
437 string getName() const
438 {
439 return "GetShapeF0D";
440 }
441
444};
445
446// GetOccludersF0D
448class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> {
449 public:
451 string getName() const
452 {
453 return "GetOccludersF0D";
454 }
455
458};
459
460// GetOccludeeF0D
462class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> {
463 public:
465 string getName() const
466 {
467 return "GetOccludeeF0D";
468 }
469
472};
473
475
476// getFEdge
478
479// getFEdges
480void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2);
481
482// getViewEdges
483void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2);
484
485// getShapeF0D
487
488// getOccludersF0D
489void getOccludersF0D(Interface0DIterator &it, std::set<ViewShape *> &oOccluders);
490
491// getOccludeeF0D
493
494} // end of namespace Functions0D
495
496} /* 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:78
virtual int operator()(Interface0DIterator &iter)
Definition Functions0D.h:89
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)
inherits from class Rep
Definition AppCanvas.cpp:20