Blender  V3.3
Operators.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include <iostream>
11 #include <vector>
12 
13 #include "Chain.h"
14 #include "ChainingIterators.h"
15 #include "Predicates0D.h"
16 #include "Predicates1D.h"
17 #include "StrokeShader.h"
18 
19 #include "../system/TimeStamp.h"
20 
21 #include "../view_map/Interface1D.h"
22 #include "../view_map/ViewMap.h"
23 
24 #ifdef WITH_CXX_GUARDEDALLOC
25 # include "MEM_guardedalloc.h"
26 #endif
27 
28 namespace Freestyle {
29 
35 class Operators {
36 
37  public:
38  typedef vector<Interface1D *> I1DContainer;
39  typedef vector<Stroke *> StrokesContainer;
40 
41  //
42  // Operators
43  //
45 
49  static int select(UnaryPredicate1D &pred);
50 
66  UnaryPredicate1D &pred,
67  UnaryFunction1D_void &modifier);
68 
83 
99 
114  static int bidirectionalChain(ChainingIterator &it);
115 
132  static int sequentialSplit(UnaryPredicate0D &startingPred,
133  UnaryPredicate0D &stoppingPred,
134  float sampling = 0.0f);
135 
147  static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
148 
166  static int recursiveSplit(UnaryFunction0D<double> &func,
167  UnaryPredicate1D &pred,
168  float sampling = 0);
169 
194  static int recursiveSplit(UnaryFunction0D<double> &func,
195  UnaryPredicate0D &pred0d,
196  UnaryPredicate1D &pred,
197  float sampling = 0.0f);
198 
204  static int sort(BinaryPredicate1D &pred);
205 
213  static int create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders);
214 
215  //
216  // Data access
217  //
219 
220  static ViewEdge *getViewEdgeFromIndex(unsigned i)
221  {
222  return dynamic_cast<ViewEdge *>(_current_view_edges_set[i]);
223  }
224 
225  static Chain *getChainFromIndex(unsigned i)
226  {
227  return dynamic_cast<Chain *>(_current_chains_set[i]);
228  }
229 
230  static Stroke *getStrokeFromIndex(unsigned i)
231  {
232  return _current_strokes_set[i];
233  }
234 
235  static unsigned getViewEdgesSize()
236  {
237  return _current_view_edges_set.size();
238  }
239 
240  static unsigned getChainsSize()
241  {
242  return _current_chains_set.size();
243  }
244 
245  static unsigned getStrokesSize()
246  {
247  return _current_strokes_set.size();
248  }
249 
250  //
251  // Not exported in Python
252  //
254 
256  {
257  return &_current_strokes_set;
258  }
259 
260  static void reset(bool removeStrokes = true);
261 
262  private:
263  Operators()
264  {
265  }
266 
267  static I1DContainer _current_view_edges_set;
268  static I1DContainer _current_chains_set;
269  static I1DContainer *_current_set;
270  static StrokesContainer _current_strokes_set;
271 
272 #ifdef WITH_CXX_GUARDEDALLOC
273  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Operators")
274 #endif
275 };
276 
277 } /* namespace Freestyle */
Class to define a chain of viewedges.
Chaining iterators.
Read Guarded memory(de)allocation.
Class gathering stroke creation algorithms.
Class gathering stroke creation algorithms.
Class defining StrokeShader.
static int sort(BinaryPredicate1D &pred)
Definition: Operators.cpp:1054
static int select(UnaryPredicate1D &pred)
Definition: Operators.cpp:26
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred, UnaryFunction1D_void &modifier)
Definition: Operators.cpp:68
static void reset(bool removeStrokes=true)
Definition: Operators.cpp:1303
static ViewEdge * getViewEdgeFromIndex(unsigned i)
Definition: Operators.h:220
static StrokesContainer * getStrokesSet()
Definition: Operators.h:255
vector< Interface1D * > I1DContainer
Definition: Operators.h:38
static int sequentialSplit(UnaryPredicate0D &startingPred, UnaryPredicate0D &stoppingPred, float sampling=0.0f)
Definition: Operators.cpp:580
static int recursiveSplit(UnaryFunction0D< double > &func, UnaryPredicate1D &pred, float sampling=0)
Definition: Operators.cpp:790
static unsigned getViewEdgesSize()
Definition: Operators.h:235
static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
Definition: Operators.cpp:315
static Stroke * getStrokeFromIndex(unsigned i)
Definition: Operators.h:230
static Chain * getChainFromIndex(unsigned i)
Definition: Operators.h:225
static int create(UnaryPredicate1D &pred, vector< StrokeShader * > shaders)
Definition: Operators.cpp:1259
static unsigned getStrokesSize()
Definition: Operators.h:245
vector< Stroke * > StrokesContainer
Definition: Operators.h:39
static unsigned getChainsSize()
Definition: Operators.h:240
inherits from class Rep
Definition: AppCanvas.cpp:18