Blender  V3.3
Bezier.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include <vector>
11 
12 #include "Geom.h"
13 
14 #include "../system/FreestyleConfig.h"
15 
16 #ifdef WITH_CXX_GUARDEDALLOC
17 # include "MEM_guardedalloc.h"
18 #endif
19 
20 namespace Freestyle {
21 
22 using namespace Geometry;
23 
25  private:
26  std::vector<Vec2d> _ControlPolygon;
27  std::vector<Vec2d> _Vertices;
28 
29  public:
31 
32  void AddControlPoint(const Vec2d &iPoint);
33  void Build();
34 
35  inline int size() const
36  {
37  return _ControlPolygon.size();
38  }
39 
40  inline std::vector<Vec2d> &vertices()
41  {
42  return _Vertices;
43  }
44 
45 #ifdef WITH_CXX_GUARDEDALLOC
46  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BezierCurveSegment")
47 #endif
48 };
49 
50 class BezierCurve {
51  private:
52  std::vector<Vec2d> _ControlPolygon;
53  std::vector<BezierCurveSegment *> _Segments;
54  BezierCurveSegment *_currentSegment;
55 
56  public:
57  BezierCurve();
58  BezierCurve(std::vector<Vec2d> &iPoints, double error = 4.0);
59  virtual ~BezierCurve();
60 
61  void AddControlPoint(const Vec2d &iPoint);
62 
63  std::vector<Vec2d> &controlPolygon()
64  {
65  return _ControlPolygon;
66  }
67 
68  std::vector<BezierCurveSegment *> &segments()
69  {
70  return _Segments;
71  }
72 
73 #ifdef WITH_CXX_GUARDEDALLOC
74  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BezierCurve")
75 #endif
76 };
77 
78 } /* namespace Freestyle */
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
std::vector< Vec2d > & vertices()
Definition: Bezier.h:40
std::vector< Vec2d > & controlPolygon()
Definition: Bezier.h:63
std::vector< BezierCurveSegment * > & segments()
Definition: Bezier.h:68
static void error(const char *str)
Definition: meshlaplacian.c:51
inherits from class Rep
Definition: AppCanvas.cpp:18
Vector2 * BezierCurve
Definition: FitCurve.cpp:19