Blender V5.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
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
363class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
364 public:
366 string getName() const
367 {
368 return "MaterialF0D";
369 }
370
373};
374
375// ShapeIdF0D
383class ShapeIdF0D : public UnaryFunction0D<Id> {
384 public:
386 string getName() const
387 {
388 return "ShapeIdF0D";
389 }
390
393};
394
395// QiF0D
404 public:
406 string getName() const
407 {
408 return "QuantitativeInvisibilityF0D";
409 }
410
413};
414
415// CurveNatureF0D
417class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> {
418 public:
420 string getName() const
421 {
422 return "CurveNatureF0D";
423 }
424
427};
428
429// GetShapeF0D
431class GetShapeF0D : public UnaryFunction0D<ViewShape *> {
432 public:
434 string getName() const
435 {
436 return "GetShapeF0D";
437 }
438
441};
442
443// GetOccludersF0D
445class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> {
446 public:
448 string getName() const
449 {
450 return "GetOccludersF0D";
451 }
452
455};
456
457// GetOccludeeF0D
459class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> {
460 public:
462 string getName() const
463 {
464 return "GetOccludeeF0D";
465 }
466
469};
470
472
473// getFEdge
475
476// getFEdges
477void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2);
478
479// getViewEdges
480void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2);
481
482// getShapeF0D
484
485// getOccludersF0D
486void getOccludersF0D(Interface0DIterator &it, std::set<ViewShape *> &oOccluders);
487
488// getOccludeeF0D
490
491} // end of namespace Functions0D
492
493} /* namespace Freestyle */
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 Blender memory allocation and freeing.
Define the float precision used in the program.
SIMD_FORCE_INLINE btVector3 operator()(const btVector3 &x) const
Return the transform of the vector.
Definition btTransform.h:90
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::Vec3< float > Vec3f
Definition Geom.h:28
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20