|
Core 1.0
|
Bézier curves. More...
#include <bezier.h>
Public Member Functions | |
| BezierCurve2 () | |
| Empty. | |
| BezierCurve2 (const QVector< Vector2 > &) | |
| Create a Bézier curve. | |
| ~BezierCurve2 () | |
| Empty. | |
| int | Degree () const |
| Return the degree of the curve. | |
| Vector2 | Vertex (int) const |
| Return the control point. | |
| Vector2 | Point (const double &) const |
| Compute a point on the curve. | |
| Vector2 | Tangent (const double &) const |
| Compute the tangent at a given point on the curve. | |
| Vector2 | Second (const double &) const |
| Compute the secondary derivative a given point on the curve. | |
| Vector2 | DeCasteljau (const double &) const |
| Compute a point on the curve using De Casteljau's algorithm. | |
| Box2 | GetBox () const |
| Return the bounding box. | |
| PointCurve2 | GetPolyLine () const |
| Return the poly-line. | |
| Polygon2 | GetPolygon () const |
| Return the polygon. | |
| void | Rotate (const Matrix2 &) |
| Rotates the curve. | |
| void | Translate (const Vector2 &) |
| Translation. | |
| void | Scale (const Vector2 &) |
| Scale. | |
| void | Transform (const Frame2 &) |
| Transforms the curve. | |
| void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
| Draw the curve. | |
Protected Attributes | |
| QVector< Vector2 > | c |
| Control points. | |
Bézier curves.
|
explicit |
Create a Bézier curve.
| c | Set of control points. |
| Vector2 BezierCurve2::DeCasteljau | ( | const double & | u | ) | const |
Compute a point on the curve using De Casteljau's algorithm.
| u | Coordinates. |
| void BezierCurve2::Draw | ( | QGraphicsScene & | scene, |
| const QPen & | pen = QPen(), | ||
| const QBrush & | = QBrush() ) const |
Draw the curve.
| scene | Graphics scene. |
| pen | Pen. |
| brush | Brush. |
| Vector2 BezierCurve2::Point | ( | const double & | u | ) | const |
Compute a point on the curve.
| u | Coordinates. |
| void BezierCurve2::Rotate | ( | const Matrix2 & | r | ) |
Rotates the curve.
| r | Rotation matrix. |
| void BezierCurve2::Scale | ( | const Vector2 & | s | ) |
Scale.
| s | Scaling vector. |
| Vector2 BezierCurve2::Second | ( | const double & | u | ) | const |
Compute the secondary derivative a given point on the curve.
The second derivative of a curve of degree n is a curve of degree n-2:
\[ c''(u) = n(n-1) \sum_{i=0}^{n-2} (p_{i+2} - 2 p_{i+1} + p_i) B_i^{n-2}(u) \]
where \( B_i^{n-2} \) are the Bernstein polynomials of degree n-2, computed by Math::BernsteinSeries() with n-1 terms.
| u | Coordinates. |
| Vector2 BezierCurve2::Tangent | ( | const double & | u | ) | const |
Compute the tangent at a given point on the curve.
| u | Coordinates. |
| void BezierCurve2::Transform | ( | const Frame2 & | frame | ) |
Transforms the curve.
| frame | Transformation. |
| void BezierCurve2::Translate | ( | const Vector2 & | t | ) |
Translation.
| t | Translation vector. |
|
inline |
Return the control point.
| i | Index. |