Blender  V2.93
Functions0D.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <set>
25 #include <vector>
26 
27 #include "Interface0D.h"
28 
29 #include "../geometry/Geom.h"
30 
31 #include "../python/Director.h"
32 
33 #include "../scene_graph/FrsMaterial.h"
34 
35 #include "../system/Exception.h"
36 #include "../system/Precision.h"
37 
38 #ifdef WITH_CXX_GUARDEDALLOC
39 # include "MEM_guardedalloc.h"
40 #endif
41 
42 namespace Freestyle {
43 
44 class FEdge;
45 class ViewEdge;
46 class SShape;
47 
48 using namespace Geometry;
49 
50 //
51 // UnaryFunction0D (base class for functions in 0D)
52 //
54 
72 template<class T> class UnaryFunction0D {
73  public:
75  void *py_uf0D;
76 
79 
82  {
83  py_uf0D = NULL;
84  }
85 
87  virtual ~UnaryFunction0D()
88  {
89  }
90 
92  virtual string getName() const
93  {
94  return "UnaryFunction0D";
95  }
96 
102  /* FIXME move the implementation to Functions0D.cpp */
103  virtual int operator()(Interface0DIterator &iter)
104  {
105  return Director_BPy_UnaryFunction0D___call__(this, py_uf0D, iter);
106  }
107 
108 #ifdef WITH_CXX_GUARDEDALLOC
109  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:UnaryFunction0D")
110 #endif
111 };
112 
113 #ifdef SWIG
114 %feature("director") UnaryFunction0D<void>;
115 %feature("director") UnaryFunction0D<unsigned>;
116 %feature("director") UnaryFunction0D<float>;
117 %feature("director") UnaryFunction0D<double>;
118 %feature("director") UnaryFunction0D<Vec2f>;
119 %feature("director") UnaryFunction0D<Vec3f>;
120 %feature("director") UnaryFunction0D<Id>;
121 
122 %template(UnaryFunction0DVoid) UnaryFunction0D<void>;
123 %template(UnaryFunction0DUnsigned) UnaryFunction0D<unsigned>;
124 %template(UnaryFunction0DFloat) UnaryFunction0D<float>;
125 %template(UnaryFunction0DDouble) UnaryFunction0D<double>;
126 %template(UnaryFunction0DVec2f) UnaryFunction0D<Vec2f>;
127 %template(UnaryFunction0DVec3f) UnaryFunction0D<Vec3f>;
128 %template(UnaryFunction0DId) UnaryFunction0D<Id>;
129 %template(UnaryFunction0DViewShape) UnaryFunction0D<ViewShape*>;
130 %template(UnaryFunction0DVectorViewShape) UnaryFunction0D<std::vector<ViewShape*> >;
131 #endif // SWIG
132 
133 //
134 // Functions definitions
135 //
137 class ViewShape;
138 
139 namespace Functions0D {
140 
141 // GetXF0D
143 class GetXF0D : public UnaryFunction0D<double> {
144  public:
146  string getName() const
147  {
148  return "GetXF0D";
149  }
150 
153  {
154  result = iter->getX();
155  return 0;
156  }
157 };
158 
159 // GetYF0D
161 class GetYF0D : public UnaryFunction0D<double> {
162  public:
164  string getName() const
165  {
166  return "GetYF0D";
167  }
168 
171  {
172  result = iter->getY();
173  return 0;
174  }
175 };
176 
177 // GetZF0D
179 class GetZF0D : public UnaryFunction0D<double> {
180  public:
182  string getName() const
183  {
184  return "GetZF0D";
185  }
186 
189  {
190  result = iter->getZ();
191  return 0;
192  }
193 };
194 
195 // GetProjectedXF0D
197 class GetProjectedXF0D : public UnaryFunction0D<double> {
198  public:
200  string getName() const
201  {
202  return "GetProjectedXF0D";
203  }
204 
207  {
208  result = iter->getProjectedX();
209  return 0;
210  }
211 };
212 
213 // GetProjectedYF0D
215 class GetProjectedYF0D : public UnaryFunction0D<double> {
216  public:
218  string getName() const
219  {
220  return "GetProjectedYF0D";
221  }
222 
225  {
226  result = iter->getProjectedY();
227  return 0;
228  }
229 };
230 
231 // GetProjectedZF0D
233 class GetProjectedZF0D : public UnaryFunction0D<double> {
234  public:
236  string getName() const
237  {
238  return "GetProjectedZF0D";
239  }
240 
243  {
244  result = iter->getProjectedZ();
245  return 0;
246  }
247 };
248 
249 // GetCurvilinearAbscissaF0D
252  public:
254  string getName() const
255  {
256  return "GetCurvilinearAbscissaF0D";
257  }
258 
261  {
262  result = iter.t();
263  return 0;
264  }
265 };
266 
267 // GetParameterF0D
269 class GetParameterF0D : public UnaryFunction0D<float> {
270  public:
272  string getName() const
273  {
274  return "GetParameterF0D";
275  }
276 
279  {
280  result = iter.u();
281  return 0;
282  }
283 };
284 
285 // VertexOrientation2DF0D
291  public:
293  string getName() const
294  {
295  return "VertexOrientation2DF0D";
296  }
297 
299  int operator()(Interface0DIterator &iter);
300 };
301 
302 // VertexOrientation3DF0D
308  public:
310  string getName() const
311  {
312  return "VertexOrientation3DF0D";
313  }
314 
316  int operator()(Interface0DIterator &iter);
317 };
318 
319 // Curvature2DAngleF0D
324 class Curvature2DAngleF0D : public UnaryFunction0D<double> {
325  public:
327  string getName() const
328  {
329  return "Curvature2DAngleF0D";
330  }
331 
333  int operator()(Interface0DIterator &iter);
334 };
335 
336 // ZDiscontinuity
342 class ZDiscontinuityF0D : public UnaryFunction0D<double> {
343  public:
345  string getName() const
346  {
347  return "ZDiscontinuityF0D";
348  }
349 
351  int operator()(Interface0DIterator &iter);
352 };
353 
354 // Normal2DF0D
359 class Normal2DF0D : public UnaryFunction0D<Vec2f> {
360  public:
362  string getName() const
363  {
364  return "Normal2DF0D";
365  }
366 
368  int operator()(Interface0DIterator &iter);
369 };
370 
371 // MaterialF0D
380 class MaterialF0D : public UnaryFunction0D<FrsMaterial> {
381  public:
383  string getName() const
384  {
385  return "MaterialF0D";
386  }
387 
389  int operator()(Interface0DIterator &iter);
390 };
391 
392 // ShapeIdF0D
400 class ShapeIdF0D : public UnaryFunction0D<Id> {
401  public:
403  string getName() const
404  {
405  return "ShapeIdF0D";
406  }
407 
409  int operator()(Interface0DIterator &iter);
410 };
411 
412 // QiF0D
420 class QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> {
421  public:
423  string getName() const
424  {
425  return "QuantitativeInvisibilityF0D";
426  }
427 
429  int operator()(Interface0DIterator &iter);
430 };
431 
432 // CurveNatureF0D
434 class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> {
435  public:
437  string getName() const
438  {
439  return "CurveNatureF0D";
440  }
441 
443  int operator()(Interface0DIterator &iter);
444 };
445 
446 // GetShapeF0D
448 class GetShapeF0D : public UnaryFunction0D<ViewShape *> {
449  public:
451  string getName() const
452  {
453  return "GetShapeF0D";
454  }
455 
457  int operator()(Interface0DIterator &iter);
458 };
459 
460 // GetOccludersF0D
462 class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> {
463  public:
465  string getName() const
466  {
467  return "GetOccludersF0D";
468  }
469 
471  int operator()(Interface0DIterator &iter);
472 };
473 
474 // GetOccludeeF0D
476 class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> {
477  public:
479  string getName() const
480  {
481  return "GetOccludeeF0D";
482  }
483 
485  int operator()(Interface0DIterator &iter);
486 };
487 
489 
490 // getFEdge
492 
493 // getFEdges
494 void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2);
495 
496 // getViewEdges
497 void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2);
498 
499 // getShapeF0D
501 
502 // getOccludersF0D
503 void getOccludersF0D(Interface0DIterator &it, std::set<ViewShape *> &oOccluders);
504 
505 // getOccludeeF0D
507 
508 } // end of namespace Functions0D
509 
510 } /* namespace Freestyle */
int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator &if0D_it)
Definition: Director.cpp:239
Interface to 0D elts.
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE btVector3 operator()(const btVector3 &x) const
Return the transform of the vector.
Definition: btTransform.h:90
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:260
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:278
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:206
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:224
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:242
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:152
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:170
int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:188
virtual real getProjectedX() const
Definition: Interface0D.cpp:55
virtual real getZ() const
Definition: Interface0D.cpp:43
virtual real getY() const
Definition: Interface0D.cpp:37
virtual real getProjectedZ() const
Definition: Interface0D.cpp:67
virtual real getX() const
Definition: Interface0D.cpp:31
virtual real getProjectedY() const
Definition: Interface0D.cpp:61
virtual string getName() const
Definition: Functions0D.h:92
virtual int operator()(Interface0DIterator &iter)
Definition: Functions0D.h:103
#define T
ViewShape * getShapeF0D(Interface0DIterator &it)
void getOccludersF0D(Interface0DIterator &it, std::set< ViewShape * > &oOccluders)
ViewShape * getOccludeeF0D(Interface0DIterator &it)
void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2)
Definition: Functions0D.cpp:37
FEdge * getFEdge(Interface0D &it1, Interface0D &it2)
Definition: Functions0D.cpp:32
void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2)
Definition: Functions0D.cpp:91
VecMat::Vec2< float > Vec2f
Definition: Geom.h:34
inherits from class Rep
Definition: AppCanvas.cpp:32
std::vector< ElementType, Eigen::aligned_allocator< ElementType > > vector
Definition: vector.h:39