Blender V5.0
Functions1D.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 "Functions0D.h"
13#include "Interface1D.h"
14#include "ViewMap.h"
15
17#include "../system/Precision.h"
18#include "../system/TimeStamp.h"
19
20#include "../python/Director.h"
21
22#include "MEM_guardedalloc.h"
23
24namespace Freestyle {
25
26//
27// UnaryFunction1D (base class for functions in 1D)
28//
30
45template<class T> class UnaryFunction1D {
46 public:
48 void *py_uf1D;
49
52
58
66 {
67 _integration = iType;
68 }
69
71 virtual ~UnaryFunction1D() {}
72
74 virtual string getName() const
75 {
76 return "UnaryFunction1D";
77 }
78
84 /* FIXME move the implementation to Functions1D.cpp */
85 virtual int operator()(Interface1D &inter)
86 {
88 }
89
92 {
93 _integration = integration;
94 }
95
98 {
99 return _integration;
100 }
101
102 protected:
104
105 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D")
106};
107
109 public:
110 void *py_uf1D;
111
116
118 {
119 _integration = iType;
120 }
121
123
124 virtual string getName() const
125 {
126 return "UnaryFunction1D_void";
127 }
128
129 /* FIXME move the implementation to Functions1D.cpp */
131 {
133 }
134
136 {
137 _integration = integration;
138 }
139
141 {
142 return _integration;
143 }
144
145 protected:
147
148 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D_void")
149};
150
151//
152// Functions definitions
153//
155
156namespace Functions1D {
157
158// GetXF1D
160class GetXF1D : public UnaryFunction1D<double> {
161 private:
163
164 public:
169 GetXF1D(IntegrationType iType) : UnaryFunction1D<double>(iType) {}
170
172 string getName() const
173 {
174 return "GetXF1D";
175 }
176
178 int operator()(Interface1D &inter);
179};
180
181// GetYF1D
183class GetYF1D : public UnaryFunction1D<double> {
184 private:
186
187 public:
192 GetYF1D(IntegrationType iType = MEAN) : UnaryFunction1D<double>(iType) {}
193
195 string getName() const
196 {
197 return "GetYF1D";
198 }
199
201 int operator()(Interface1D &inter);
202};
203
204// GetZF1D
206class GetZF1D : public UnaryFunction1D<double> {
207 private:
209
210 public:
215 GetZF1D(IntegrationType iType = MEAN) : UnaryFunction1D<double>(iType) {}
216
218 string getName() const
219 {
220 return "GetZF1D";
221 }
222
224 int operator()(Interface1D &inter);
225};
226
227// GetProjectedXF1D
229class GetProjectedXF1D : public UnaryFunction1D<double> {
230 private:
232
233 public:
239
241 string getName() const
242 {
243 return "GetProjectedXF1D";
244 }
245
247 int operator()(Interface1D &inter);
248};
249
250// GetProjectedYF1D
252class GetProjectedYF1D : public UnaryFunction1D<double> {
253 private:
255
256 public:
262
264 string getName() const
265 {
266 return "GetProjectedYF1D";
267 }
268
270 int operator()(Interface1D &inter);
271};
272
273// GetProjectedZF1D
275class GetProjectedZF1D : public UnaryFunction1D<double> {
276 private:
278
279 public:
285
287 string getName() const
288 {
289 return "GetProjectedZF1D";
290 }
291
293 int operator()(Interface1D &inter);
294};
295
296// Orientation2DF1D
298class Orientation2DF1D : public UnaryFunction1D<Vec2f> {
299 private:
301
302 public:
308
310 string getName() const
311 {
312 return "Orientation2DF1D";
313 }
314
316 int operator()(Interface1D &inter);
317};
318
319// Orientation3DF1D
321class Orientation3DF1D : public UnaryFunction1D<Vec3f> {
322 private:
324
325 public:
331
333 string getName() const
334 {
335 return "Orientation3DF1D";
336 }
337
339 int operator()(Interface1D &inter);
340};
341
342// ZDiscontinuityF1D
348class ZDiscontinuityF1D : public UnaryFunction1D<double> {
349 private:
351
352 public:
358
360 string getName() const
361 {
362 return "ZDiscontinuityF1D";
363 }
364
366 int operator()(Interface1D &inter);
367};
368
369// QuantitativeInvisibilityF1D
376 private:
378
379 public:
385
387 string getName() const
388 {
389 return "QuantitativeInvisibilityF1D";
390 }
391
393 int operator()(Interface1D &inter);
394};
395
396// CurveNatureF1D
403class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> {
404 private:
406
407 public:
412 CurveNatureF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Nature::EdgeNature>(iType) {}
413
415 string getName() const
416 {
417 return "CurveNatureF1D";
418 }
419
421 int operator()(Interface1D &inter);
422};
423
424// TimeStampF1D
427 public:
429 string getName() const
430 {
431 return "TimeStampF1D";
432 }
433
435 int operator()(Interface1D &inter);
436};
437
438// IncrementChainingTimeStampF1D
441 public:
443 string getName() const
444 {
445 return "IncrementChainingTimeStampF1D";
446 }
447
449 int operator()(Interface1D &inter);
450};
451
452// ChainingTimeStampF1D
455 public:
457 string getName() const
458 {
459 return "ChainingTimeStampF1D";
460 }
461
463 int operator()(Interface1D &inter);
464};
465
466// Curvature2DAngleF1D
468class Curvature2DAngleF1D : public UnaryFunction1D<double> {
469 public:
475
477 string getName() const
478 {
479 return "Curvature2DAngleF1D";
480 }
481
484 {
485 result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
486 return 0;
487 }
488
489 private:
491};
492
493// Normal2DF1D
495class Normal2DF1D : public UnaryFunction1D<Vec2f> {
496 public:
502
504 string getName() const
505 {
506 return "Normal2DF1D";
507 }
508
511 {
512 result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
513 return 0;
514 }
515
516 private:
518};
519
520// GetShapeF1D
522class GetShapeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
523 public:
525 GetShapeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() {}
526
528 string getName() const
529 {
530 return "GetShapeF1D";
531 }
532
534 int operator()(Interface1D &inter);
535};
536
537// GetOccludersF1D
539class GetOccludersF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
540 public:
543
545 string getName() const
546 {
547 return "GetOccludersF1D";
548 }
549
551 int operator()(Interface1D &inter);
552};
553
554// GetOccludeeF1D
556class GetOccludeeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
557 public:
559 GetOccludeeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() {}
560
562 string getName() const
563 {
564 return "GetOccludeeF1D";
565 }
566
568 int operator()(Interface1D &inter);
569};
570
571// internal
573
574// getOccludeeF1D
575void getOccludeeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
576
577// getOccludersF1D
578void getOccludersF1D(Interface1D &inter, set<ViewShape *> &oShapes);
579
580// getShapeF1D
581void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
582
583} // end of namespace Functions1D
584
585} /* namespace Freestyle */
unsigned int uint
int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D &if1D)
Definition Director.cpp:293
Configuration definitions.
Functions taking 0D input.
Interface 1D and related tools definitions.
Read Guarded memory(de)allocation.
Define the float precision used in the program.
Class defining a singleton used as timestamp.
Classes to define a View Map (ViewVertex, ViewEdge, etc.).
Curvature2DAngleF1D(IntegrationType iType=MEAN)
CurveNatureF1D(IntegrationType iType=MEAN)
GetProjectedXF1D(IntegrationType iType=MEAN)
GetProjectedYF1D(IntegrationType iType=MEAN)
GetProjectedZF1D(IntegrationType iType=MEAN)
int operator()(Interface1D &inter)
int operator()(Interface1D &inter)
GetXF1D(IntegrationType iType)
int operator()(Interface1D &inter)
GetYF1D(IntegrationType iType=MEAN)
int operator()(Interface1D &inter)
GetZF1D(IntegrationType iType=MEAN)
Normal2DF1D(IntegrationType iType=MEAN)
int operator()(Interface1D &inter)
Orientation2DF1D(IntegrationType iType=MEAN)
Orientation3DF1D(IntegrationType iType=MEAN)
QuantitativeInvisibilityF1D(IntegrationType iType=MEAN)
int operator()(Interface1D &inter)
ZDiscontinuityF1D(IntegrationType iType=MEAN)
virtual Interface0DIterator verticesEnd()
virtual Interface0DIterator verticesBegin()
void setIntegrationType(IntegrationType integration)
UnaryFunction1D_void(IntegrationType iType)
IntegrationType getIntegrationType() const
virtual string getName() const
int operator()(Interface1D &inter)
virtual string getName() const
Definition Functions1D.h:74
virtual int operator()(Interface1D &inter)
Definition Functions1D.h:85
IntegrationType getIntegrationType() const
Definition Functions1D.h:97
void setIntegrationType(IntegrationType integration)
Definition Functions1D.h:91
IntegrationType _integration
UnaryFunction1D(IntegrationType iType)
Definition Functions1D.h:65
void getOccludeeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getShapeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getOccludersF1D(Interface1D &inter, set< ViewShape * > &oShapes)
VecMat::Vec3< float > Vec3f
Definition Geom.h:28
VecMat::Vec2< float > Vec2f
Definition Geom.h:22
inherits from class Rep
Definition AppCanvas.cpp:20
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
Definition Interface1D.h:73