|
Core 1.0
|
Piecewise cubic curves in the plane. More...
#include <curveset.h>
Public Member Functions | |
| CubicCurve2Set () | |
| Creates an empty piecewise quadric curve. | |
| CubicCurve2Set (const QVector< CubicCurve2 > &) | |
| Creates the piecewise quadric curve given a set of CubicCurve2. | |
| CubicCurve2Set (const QVector< Vector2 > &, const Vector2 &=Vector2::Null, const Vector2 &=Vector2::Null) | |
| Creates the piecewise cubic curve given a set of control points with the Cattmul-Rom construction. | |
| CubicCurve2Set (const CubicCurveSet &) | |
| Creates a piecewise cubic curve in the plane from a similar curve. | |
| ~CubicCurve2Set () | |
| Empty. | |
| int | Size () const |
| Return the number of elements of the piecewise cubic curve. | |
| CubicCurve2 | operator() (int) const |
| Return the i-th sub-curve. | |
| QVector< Vector2 > | GetDiscretisation (const double &) const |
| Generates a discretization of the piecewise cubic curve with a linear curvilign absisca parameterization. | |
| QVector< Vector2 > | GetDiscretisation (const double &, QVector< Vector2 > &) const |
| Generates a discretization of the curve with a linear curvilign absisca parameterization. | |
| Box2 | GetBox () const |
| Compute the bounding box of the curve. | |
| double | GetLength () const |
| Return the length of the curve. | |
| double | GetLength (int) const |
| Return the length of the sub-curve. | |
| double | Sinuosity () const |
| Compute the sinuosity. | |
| bool | Inside (const Vector2 &) const |
| Check if a point lies inside the piecewise cubic curve closed contour. | |
| int | U (const double &, double &) const |
| Compute the parameter of the curve corresponding to the input length. | |
| double | R (const Vector2 &, double &, int &) const |
| Compute the squared distance between a point and a set of cubic curves. | |
| double | Signed (const Vector2 &) const |
| Compute the signed distance between a point and a set of cubic curves forming a closed path. | |
| int | Intersect (const Ray2 &ray, int i, double t[3]) const |
| Compute the intersection between the set of curves and a ray. | |
| void | UV (const Vector2 &, double &, double &, int &) const |
| Compute the inverse mapping for a given input point. | |
| void | Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const |
| Draw the curve. | |
Protected Attributes | |
| QVector< CubicCurve2 > | curve |
| Set of 2D cubic curves. | |
| QVector< double > | lengths |
| Length of every curve. | |
| double | length = 0.0 |
| Total length. | |
Piecewise cubic curves in the plane.
The length of every curve CubicCurve2Set::lengths and the total length CubicCurve2Set::length are computed to speed up computations (internal optimization).
|
explicit |
Creates the piecewise quadric curve given a set of CubicCurve2.
| control | Set of cubic curves. |
|
explicit |
Creates the piecewise cubic curve given a set of control points with the Cattmul-Rom construction.
| control | Set of 2D points. |
| ta | Starting tangent vector. |
| tb | Ending tangent vector. |
|
explicit |
Creates a piecewise cubic curve in the plane from a similar curve.
| c | Curve. |
| void CubicCurve2Set::Draw | ( | QGraphicsScene & | scene, |
| const QPen & | pen = QPen(), | ||
| const QBrush & | brush = QBrush() ) const |
Draw the curve.
The brush is not used.
| scene | Graphics scene. |
| pen | The pen. |
| brush | The brush. |
| QVector< Vector2 > CubicCurve2Set::GetDiscretisation | ( | const double & | step | ) | const |
Generates a discretization of the piecewise cubic curve with a linear curvilign absisca parameterization.
| step | Stepping distance. |
| QVector< Vector2 > CubicCurve2Set::GetDiscretisation | ( | const double & | step, |
| QVector< Vector2 > & | tangents ) const |
Generates a discretization of the curve with a linear curvilign absisca parameterization.
| step | Stepping distance. |
| tangents | Tangents to the curve at sample points. |
|
inline |
Return the length of the sub-curve.
| k | Curve index. |
| bool CubicCurve2Set::Inside | ( | const Vector2 & | p | ) | const |
Check if a point lies inside the piecewise cubic curve closed contour.
The curve should be closed.
| p | Point. |
| int CubicCurve2Set::Intersect | ( | const Ray2 & | ray, |
| int | i, | ||
| double | t[3] ) const |
Compute the intersection between the set of curves and a ray.
| ray | The ray. |
| i | Index. |
| t | Intersection depths. |
|
inline |
Return the i-th sub-curve.
| i | Index. |
| double CubicCurve2Set::R | ( | const Vector2 & | p, |
| double & | u, | ||
| int & | k ) const |
Compute the squared distance between a point and a set of cubic curves.
| p | Point. |
| u | Parameter defining the coordinate of the projection of the argument vertex onto the curve. |
| k | Index of the curve for which the minimum distance was found. |
| double CubicCurve2Set::Signed | ( | const Vector2 & | p | ) | const |
Compute the signed distance between a point and a set of cubic curves forming a closed path.
| p | Point. |
| double CubicCurve2Set::Sinuosity | ( | ) | const |
Compute the sinuosity.
Sinusoity is defined as the ratio between the length of the curve and the distance between end points.
| int CubicCurve2Set::U | ( | const double & | s, |
| double & | u ) const |
Compute the parameter of the curve corresponding to the input length.
| s | Input length. |
| u | Parameter of the i-th curve. |
| void CubicCurve2Set::UV | ( | const Vector2 & | p, |
| double & | u, | ||
| double & | v, | ||
| int & | k ) const |
Compute the inverse mapping for a given input point.
| p | Point. |
| u,v | Inverse Coordinates, u will denote the position along the curve and v the signed distance to the curve. |
| k | Index of the curve for which the minimum distance was found. |