Bezier square curve representation.
More...
#include <BezierSquareCurve.hpp>
|
virtual void | calculateVeritces (std::vector< sf::Vector2f > &, const float, sf::Vertex *) |
| Calculate points on cuve. More...
|
|
Bezier square curve representation.
Can be drawn, inherits BezierAbstractCurve.
Use to draw/calculate simple curves.
◆ PointType
Point type enum.
Used to easly set/get points with one function – setPointPosition / getPointPosition.
Enumerator |
---|
CONTROL | Control point (handle)
|
BEGIN | Beginning of the curve.
|
END | End of the curve.
|
◆ BezierSquareCurve() [1/2]
sfc::BezierSquareCurve::BezierSquareCurve |
( |
| ) |
|
Default constructor.
Sets point count to 32 and color to white.
◆ BezierSquareCurve() [2/2]
sfc::BezierSquareCurve::BezierSquareCurve |
( |
const sf::Vector2f & |
start, |
|
|
const sf::Vector2f & |
end, |
|
|
const sf::Vector2f & |
controlPoint, |
|
|
DrawMode |
mode = DrawMode::NORMAL |
|
) |
| |
Specialized constructor.
- Parameters
-
[in] | start | – beginning of the curve |
[in] | end | – end of the curve |
[in] | controlPoint | – second control point |
Sets point count to 32 and color to white. Calls calculateCubic with proper args.
◆ calculateVeritces()
void sfc::BezierSquareCurve::calculateVeritces |
( |
std::vector< sf::Vector2f > & |
vector, |
|
|
const float |
limitCurve, |
|
|
sf::Vertex * |
debugLines |
|
) |
| |
|
protectedvirtual |
Calculate points on cuve.
- Parameters
-
[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.
Implements sfc::BezierAbstractCurve.
◆ getHelperLine()
Line2< float > sfc::BezierSquareCurve::getHelperLine |
( |
const float |
| ) |
const |
|
virtual |
Get last line used to draw a curve.
- Parameters
-
[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.
Implements sfc::BezierAbstractCurve.
◆ getPoint()
sf::Vector2f sfc::BezierSquareCurve::getPoint |
( |
std::size_t |
| ) |
const |
|
virtual |
◆ getPointPosition()
Gets position of selected point.
- Parameters
-
[in] | point | – point type (PointType enum) |
- Returns
- sf::Vector2f (position)
◆ setPointPosition()
Sets position of selected point.
- Parameters
-
[in] | point | – point type (PointType enum) |
[in] | pos | – new position |
◆ update()
void sfc::BezierSquareCurve::update |
( |
| ) |
|
|
virtual |
Calculates vertices.
Changes are applied only when this function is called.
curve.update();
curve.setColor({68, 69, 70});
window.draw(curve);
Implements sfc::BezierAbstractCurve.
The documentation for this class was generated from the following files: