sf-svg
BezierSquareCurve.hpp
Go to the documentation of this file.
1 /* =========================================================== *
2  * sf-svg (c) Kamil Koczurek | koczurekk@gmail.com *
3  * GNU GPL v3 License http://www.gnu.org/licenses/gpl-3.0.html *
4  * =========================================================== */
5 
10 
11 #ifndef BEZIERSQUARECURVE_H
12 #define BEZIERSQUARECURVE_H
13 
14 #include "BezierAbstractCurve.hpp"
15 
16 namespace sfc {
24  : public BezierAbstractCurve {
25  private:
26  sf::Vertex m_debugLines[4];
27  sf::Vector2f m_controlPoint;
28 
29  virtual void draw(sf::RenderTarget&, sf::RenderStates) const;
30 
31  protected:
32  /* Commented in base class */
33  virtual void calculateVeritces(std::vector<sf::Vector2f>&, const float, sf::Vertex*);
34 
35  public:
39  enum PointType {
42 
45 
48  };
49 
54 
63  BezierSquareCurve(const sf::Vector2f&, const sf::Vector2f&, const sf::Vector2f&, DrawMode = DrawMode::NORMAL);
64 
65  /* Commented in base class */
66  virtual Line2<float> getHelperLine(const float) const;
67 
68  /* Commented in base class */
69  virtual sf::Vector2f getPoint(std::size_t) const;
70 
71  /* Commented in base class */
72  virtual void update();
73 
78  void setPointPosition(PointType, sf::Vector2f);
79 
85  sf::Vector2f getPointPosition(PointType);
86  };
87 }
88 
89 #endif // BEZIERSQUARECURVE_H
Beginning of the curve.
Definition: BezierSquareCurve.hpp:44
sf::Vector2f getPointPosition(PointType)
Gets position of selected point.
Definition: BezierSquareCurve.cpp:98
virtual void calculateVeritces(std::vector< sf::Vector2f > &, const float, sf::Vertex *)
Calculate points on cuve.
Definition: BezierSquareCurve.cpp:30
BezierAbstractCurve declaration and partial implementation.
Namespace that contains all sf-svg method, classes, enums etc.
Definition: Base.hpp:20
Control point (handle)
Definition: BezierSquareCurve.hpp:41
virtual Line2< float > getHelperLine(const float) const
Get last line used to draw a curve.
Definition: BezierSquareCurve.cpp:71
DrawMode
Way to draw curves.
Definition: Base.hpp:23
BezierSquareCurve()
Default constructor.
Definition: BezierSquareCurve.cpp:50
PointType
Point type enum.
Definition: BezierSquareCurve.hpp:39
void setPointPosition(PointType, sf::Vector2f)
Sets position of selected point.
Definition: BezierSquareCurve.cpp:85
End of the curve.
Definition: BezierSquareCurve.hpp:47
Just draw the curve.
Abstract Bezier curve class.
Definition: BezierAbstractCurve.hpp:59
virtual sf::Vector2f getPoint(std::size_t) const
Get n-th point of curve.
Definition: BezierSquareCurve.cpp:78
virtual void update()
Calculates vertices.
Definition: BezierSquareCurve.cpp:111
2D line
Definition: Base.hpp:49
Bezier square curve representation.
Definition: BezierSquareCurve.hpp:23