sf-svg
|
Abstract Bezier curve class. More...
#include <BezierAbstractCurve.hpp>
Public Member Functions | |
virtual Line2< float > | getHelperLine (const float) const =0 |
Get last line used to draw a curve. More... | |
virtual void | update ()=0 |
Calculates vertices. More... | |
virtual std::size_t | getPointCount () const |
Returns point count. | |
virtual sf::Vector2f | getPoint (std::size_t) const =0 |
Get n-th point of curve. More... | |
virtual | ~BezierAbstractCurve () |
Virtual destructor. More... | |
virtual void | calculateVeritces (std::vector< sf::Vector2f > &vector, const float limitCurve, sf::Vertex *debugLines)=0 |
Calculate points on cuve. More... | |
void | setColor (const sf::Color &) |
Sets color. More... | |
sf::Color | getColor () |
Returns color of curve. | |
void | setNormalizedLengthLimit (const float) |
Set part of curve to be drawn. More... | |
float | getNormalizedLengthLimit () |
Get part of curve to be drawn. More... | |
void | setPointCount (const std::size_t) |
Set amount of points to draw curve. More... | |
void | move (sf::Vector2f) |
Translate curve. | |
void | scale (const sf::Vector2f &factor) |
Scale curve. | |
Protected Attributes | |
VertexVector< sf::LinesStrip > | m_vertices |
Vertices used to draw curve. | |
std::size_t | m_pointCount |
Stores points count. | |
sf::Color | m_color |
Curve's color. | |
sf::Vector2f | m_begin |
First point of a curve. | |
sf::Vector2f | m_end |
Last point of a curve. | |
float | m_limitCurve |
Part of curve to be drawn. More... | |
DrawMode | m_mode |
Drawing mode. More... | |
Abstract Bezier curve class.
Do not define methods!
Inherit it to create class compatibile with Brezier Curve API.
Remember, it's not an interface, this class contains variables and some definied methods – getters & setters (mostly).
|
inlinevirtual |
Virtual destructor.
Does nothing expect of ensuring that destructors of inherited classes will be called.
|
pure virtual |
Calculate points on cuve.
[out] | vector | – vector to store vertices |
[in] | limitCurve | – part of curve to be drawn, range [0, 1] |
[out] | debugLines | – vertex array, used to store and draw helper lines |
Calculates all curve-related things like vertices positions / helper lines etc. Not a big deal, use only if you really want to inherit BezierCubicCurve.
Implemented in sfc::BezierCubicCurve, and sfc::BezierSquareCurve.
|
pure virtual |
Get last line used to draw a curve.
[in] | normalized | – progress of drawing curve in range [0, 1] |
Other helper lines are ignored, this function returns the one, on which "pencil" is placed.
Implemented in sfc::BezierCubicCurve, and sfc::BezierSquareCurve.
float sfc::BezierAbstractCurve::getNormalizedLengthLimit | ( | ) |
Get part of curve to be drawn.
Take a look at setNormalizedLengthLimit() and m_limitCurve.
|
pure virtual |
Get n-th point of curve.
[in] | index | – point index |
Implemented in sfc::BezierCubicCurve, and sfc::BezierSquareCurve.
void sfc::BezierAbstractCurve::setColor | ( | const sf::Color & | color | ) |
Sets color.
[in] | color | – New color |
Use to set color of curve's vertices.
void sfc::BezierAbstractCurve::setNormalizedLengthLimit | ( | const float | limit | ) |
Set part of curve to be drawn.
[in] | normalized | – part of curve to be drawn in range [0, 1] |
void sfc::BezierAbstractCurve::setPointCount | ( | const std::size_t | count | ) |
Set amount of points to draw curve.
[in] | count | – Amount of points to use |
|
pure virtual |
Calculates vertices.
Changes are applied only when this function is called.
Implemented in sfc::BezierCubicCurve, and sfc::BezierSquareCurve.
|
protected |
Part of curve to be drawn.
Real number in range [0, 1], if set to .5 only 50% of curve will be drawn etc.
|
protected |
Drawing mode.
NORMAL – Just draw curve
DEBUG – Draw also helper lines etc.