Blender V4.3
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
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#ifdef WITH_CXX_GUARDEDALLOC
23# include "MEM_guardedalloc.h"
24#endif
25
26namespace Freestyle {
27
28//
29// UnaryFunction1D (base class for functions in 1D)
30//
32
47template<class T> class UnaryFunction1D {
48 public:
50 void *py_uf1D;
51
54
60
68 {
69 _integration = iType;
70 }
71
73 virtual ~UnaryFunction1D() {}
74
76 virtual string getName() const
77 {
78 return "UnaryFunction1D";
79 }
80
86 /* FIXME move the implementation to Functions1D.cpp */
87 virtual int operator()(Interface1D &inter)
88 {
90 }
91
94 {
95 _integration = integration;
96 }
97
100 {
101 return _integration;
102 }
103
104 protected:
106
107#ifdef WITH_CXX_GUARDEDALLOC
108 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D")
109#endif
110};
111
113 public:
114 void *py_uf1D;
115
120
122 {
123 _integration = iType;
124 }
125
127
128 virtual string getName() const
129 {
130 return "UnaryFunction1D_void";
131 }
132
133 /* FIXME move the implementation to Functions1D.cpp */
135 {
137 }
138
140 {
141 _integration = integration;
142 }
143
145 {
146 return _integration;
147 }
148
149 protected:
151
152#ifdef WITH_CXX_GUARDEDALLOC
153 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction1D_void")
154#endif
155};
156
157//
158// Functions definitions
159//
161
162namespace Functions1D {
163
164// GetXF1D
166class GetXF1D : public UnaryFunction1D<double> {
167 private:
169
170 public:
176
178 string getName() const
179 {
180 return "GetXF1D";
181 }
182
184 int operator()(Interface1D &inter);
185};
186
187// GetYF1D
189class GetYF1D : public UnaryFunction1D<double> {
190 private:
192
193 public:
199
201 string getName() const
202 {
203 return "GetYF1D";
204 }
205
207 int operator()(Interface1D &inter);
208};
209
210// GetZF1D
212class GetZF1D : public UnaryFunction1D<double> {
213 private:
215
216 public:
222
224 string getName() const
225 {
226 return "GetZF1D";
227 }
228
230 int operator()(Interface1D &inter);
231};
232
233// GetProjectedXF1D
235class GetProjectedXF1D : public UnaryFunction1D<double> {
236 private:
238
239 public:
245
247 string getName() const
248 {
249 return "GetProjectedXF1D";
250 }
251
253 int operator()(Interface1D &inter);
254};
255
256// GetProjectedYF1D
258class GetProjectedYF1D : public UnaryFunction1D<double> {
259 private:
261
262 public:
268
270 string getName() const
271 {
272 return "GetProjectedYF1D";
273 }
274
276 int operator()(Interface1D &inter);
277};
278
279// GetProjectedZF1D
281class GetProjectedZF1D : public UnaryFunction1D<double> {
282 private:
284
285 public:
291
293 string getName() const
294 {
295 return "GetProjectedZF1D";
296 }
297
299 int operator()(Interface1D &inter);
300};
301
302// Orientation2DF1D
304class Orientation2DF1D : public UnaryFunction1D<Vec2f> {
305 private:
307
308 public:
314
316 string getName() const
317 {
318 return "Orientation2DF1D";
319 }
320
322 int operator()(Interface1D &inter);
323};
324
325// Orientation3DF1D
327class Orientation3DF1D : public UnaryFunction1D<Vec3f> {
328 private:
330
331 public:
337
339 string getName() const
340 {
341 return "Orientation3DF1D";
342 }
343
345 int operator()(Interface1D &inter);
346};
347
348// ZDiscontinuityF1D
354class ZDiscontinuityF1D : public UnaryFunction1D<double> {
355 private:
357
358 public:
364
366 string getName() const
367 {
368 return "ZDiscontinuityF1D";
369 }
370
372 int operator()(Interface1D &inter);
373};
374
375// QuantitativeInvisibilityF1D
382 private:
384
385 public:
391
393 string getName() const
394 {
395 return "QuantitativeInvisibilityF1D";
396 }
397
399 int operator()(Interface1D &inter);
400};
401
402// CurveNatureF1D
409class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> {
410 private:
412
413 public:
418 CurveNatureF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Nature::EdgeNature>(iType) {}
419
421 string getName() const
422 {
423 return "CurveNatureF1D";
424 }
425
427 int operator()(Interface1D &inter);
428};
429
430// TimeStampF1D
433 public:
435 string getName() const
436 {
437 return "TimeStampF1D";
438 }
439
441 int operator()(Interface1D &inter);
442};
443
444// IncrementChainingTimeStampF1D
447 public:
449 string getName() const
450 {
451 return "IncrementChainingTimeStampF1D";
452 }
453
455 int operator()(Interface1D &inter);
456};
457
458// ChainingTimeStampF1D
461 public:
463 string getName() const
464 {
465 return "ChainingTimeStampF1D";
466 }
467
469 int operator()(Interface1D &inter);
470};
471
472// Curvature2DAngleF1D
474class Curvature2DAngleF1D : public UnaryFunction1D<double> {
475 public:
481
483 string getName() const
484 {
485 return "Curvature2DAngleF1D";
486 }
487
490 {
491 result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
492 return 0;
493 }
494
495 private:
497};
498
499// Normal2DF1D
501class Normal2DF1D : public UnaryFunction1D<Vec2f> {
502 public:
508
510 string getName() const
511 {
512 return "Normal2DF1D";
513 }
514
517 {
518 result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration);
519 return 0;
520 }
521
522 private:
524};
525
526// GetShapeF1D
528class GetShapeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
529 public:
531 GetShapeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() {}
532
534 string getName() const
535 {
536 return "GetShapeF1D";
537 }
538
540 int operator()(Interface1D &inter);
541};
542
543// GetOccludersF1D
545class GetOccludersF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
546 public:
549
551 string getName() const
552 {
553 return "GetOccludersF1D";
554 }
555
557 int operator()(Interface1D &inter);
558};
559
560// GetOccludeeF1D
562class GetOccludeeF1D : public UnaryFunction1D<std::vector<ViewShape *>> {
563 public:
565 GetOccludeeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() {}
566
568 string getName() const
569 {
570 return "GetOccludeeF1D";
571 }
572
574 int operator()(Interface1D &inter);
575};
576
577// internal
579
580// getOccludeeF1D
581void getOccludeeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
582
583// getOccludersF1D
584void getOccludersF1D(Interface1D &inter, set<ViewShape *> &oShapes);
585
586// getShapeF1D
587void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes);
588
589} // end of namespace Functions1D
590
591} /* namespace Freestyle */
unsigned int uint
typedef double(DMatrix)[4][4]
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:76
virtual int operator()(Interface1D &inter)
Definition Functions1D.h:87
IntegrationType getIntegrationType() const
Definition Functions1D.h:99
void setIntegrationType(IntegrationType integration)
Definition Functions1D.h:93
IntegrationType _integration
UnaryFunction1D(IntegrationType iType)
Definition Functions1D.h:67
void getOccludeeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getShapeF1D(Interface1D &inter, set< ViewShape * > &oShapes)
void getOccludersF1D(Interface1D &inter, set< ViewShape * > &oShapes)
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:75