Base class for all splines. More...
#include <qwt_spline.h>
Classes | |
class | PrivateData |
Public Types | |
enum | BoundaryCondition { Clamped1, Clamped2, Clamped3, LinearRunout } |
Boundary condition. More... | |
enum | BoundaryPosition { AtBeginning, AtEnd } |
enum | BoundaryType { ConditionalBoundaries, PeriodicPolygon, ClosedPolygon } |
Public Member Functions | |
int | boundaryCondition (BoundaryPosition) const |
BoundaryType | boundaryType () const |
double | boundaryValue (BoundaryPosition) const |
virtual uint | locality () const |
virtual QPainterPath | painterPath (const QPolygonF &) const =0 |
const QwtSplineParametrization * | parametrization () const |
virtual QPolygonF | polygon (const QPolygonF &, double tolerance) const |
Interpolate a curve by a polygon. | |
QwtSpline () | |
Constructor. | |
void | setBoundaryCondition (BoundaryPosition, int condition) |
Define the condition for an endpoint of the spline. | |
void | setBoundaryConditions (int condition, double valueBegin=0.0, double valueEnd=0.0) |
Define the condition at the endpoints of a spline. | |
void | setBoundaryType (BoundaryType) |
void | setBoundaryValue (BoundaryPosition, double value) |
Define the boundary value. | |
void | setParametrization (int type) |
void | setParametrization (QwtSplineParametrization *) |
virtual | ~QwtSpline () |
Destructor. | |
Private Attributes | |
PrivateData * | d_data |
Base class for all splines.
A spline is a curve represented by a sequence of polynomials. Spline approximation is the process of finding polynomials for a given set of points. When the algorithm preserves the initial points it is called interpolating.
Splines can be classified according to conditions of the polynomials that are met at the start/endpoints of the pieces:
Geometric continuity requires the geometry to be continuous, while parametric continuity requires that the underlying parameterization be continuous as well. Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.
QwtSpline is the base class for spline approximations of any continuity.
Definition at line 53 of file qwt_spline.h.
Boundary condition.
A spline algorithm calculates polynomials by looking a couple of points back/ahead ( locality() ). At the ends additional rules are necessary to compensate the missing points.
Clamped1 |
The first derivative at the end point is given
|
Clamped2 |
The second derivative at the end point is given
|
Clamped3 |
The third derivative at the end point is given
|
LinearRunout |
The first derivate at the endpoint is related to the first derivative at its neighbour by the boundary value. F,e when the boundary value at the end is 1.0 then the slope at the last 2 points is the same.
|
Definition at line 115 of file qwt_spline.h.
position of a boundary condition
AtBeginning |
the condiation is at the beginning of the polynomial |
AtEnd |
the condiation is at the end of the polynomial |
Definition at line 95 of file qwt_spline.h.
Boundary type specifying the spline at its endpoints
ConditionalBoundaries |
The polynomials at the start/endpoint depend on specific conditions
|
PeriodicPolygon |
The polynomials at the start/endpoint are found by using imaginary additional points. Additional points at the end are found by translating points from the beginning or v.v. |
ClosedPolygon |
ClosedPolygon is similar to PeriodicPolygon beside, that the interpolation includes the connection between the last and the first control point.
|
Definition at line 61 of file qwt_spline.h.
Constructor.
The default setting is a non closing spline with chordal parametrization
Definition at line 538 of file qwt_spline.cpp.
QwtSpline::~QwtSpline | ( | ) | [virtual] |
Destructor.
Definition at line 544 of file qwt_spline.cpp.
int QwtSpline::boundaryCondition | ( | BoundaryPosition | position | ) | const |
position | At the beginning or the end of the spline |
Definition at line 649 of file qwt_spline.cpp.
double QwtSpline::boundaryValue | ( | BoundaryPosition | position | ) | const |
position | At the beginning or the end of the spline |
Definition at line 680 of file qwt_spline.cpp.
uint QwtSpline::locality | ( | ) | const [virtual] |
The locality of an spline interpolation identifies how many adjacent polynoms are affected, when changing the position of one point.
A locality of 'n' means, that changing the coordinates of a point has an effect on 'n' leading and 'n' following polynoms. Those polynoms can be calculated from a local subpolygon.
A value of 0 means, that the interpolation is not local and any modification of the polygon requires to recalculate all polynoms ( f.e cubic splines ).
Reimplemented in QwtSplineLocal, QwtSplineCubic, QwtSplineBasis, and QwtSplinePleasing.
Definition at line 562 of file qwt_spline.cpp.
QPainterPath QwtSpline::painterPath | ( | const QPolygonF & | points | ) | const [pure virtual] |
Approximates a polygon piecewise with cubic Bezier curves and returns them as QPainterPath.
points | Control points |
Implemented in QwtSplineC2, QwtSplineC1, QwtSplineInterpolating, QwtSplineLocal, QwtSplineCubic, QwtSplinePleasing, and QwtSplineBasis.
const QwtSplineParametrization * QwtSpline::parametrization | ( | ) | const |
Definition at line 603 of file qwt_spline.cpp.
QPolygonF QwtSpline::polygon | ( | const QPolygonF & | points, |
double | tolerance | ||
) | const [virtual] |
Interpolate a curve by a polygon.
Interpolates a polygon piecewise with Bezier curves interpolating them in a 2nd pass by polygons.
The interpolation is based on "Piecewise Linear Approximation of Bézier Curves" by Roger Willcocks ( http://www.rops.org )
points | Control points |
tolerance | Maximum for the accepted error of the approximation |
Reimplemented in QwtSplineInterpolating.
Definition at line 494 of file qwt_spline.cpp.
void QwtSpline::setBoundaryCondition | ( | BoundaryPosition | position, |
int | condition | ||
) |
Define the condition for an endpoint of the spline.
position | At the beginning or the end of the spline |
condition | Condition |
Definition at line 637 of file qwt_spline.cpp.
void QwtSpline::setBoundaryConditions | ( | int | condition, |
double | valueBegin = 0.0 , |
||
double | valueEnd = 0.0 |
||
) |
Define the condition at the endpoints of a spline.
condition | Condition |
valueBegin | Used for the condition at the beginning of te spline |
valueEnd | Used for the condition at the end of te spline |
Definition at line 698 of file qwt_spline.cpp.
void QwtSpline::setBoundaryType | ( | BoundaryType | boundaryType | ) |
Define the boundary type for the endpoints of the approximating spline.
boundaryType | Boundary type |
Definition at line 615 of file qwt_spline.cpp.
void QwtSpline::setBoundaryValue | ( | BoundaryPosition | position, |
double | value | ||
) |
Define the boundary value.
The boundary value is an parameter used in combination with the boundary condition. Its meaning depends on the condition.
position | At the beginning or the end of the spline |
value | Value used for the condition at the end point |
Definition at line 668 of file qwt_spline.cpp.
void QwtSpline::setParametrization | ( | int | type | ) |
Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.
type | Type of parametrization, ususally one of QwtSplineParametrization::Type |
Definition at line 574 of file qwt_spline.cpp.
void QwtSpline::setParametrization | ( | QwtSplineParametrization * | parametrization | ) |
Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.
parametrization | Parametrization |
Definition at line 590 of file qwt_spline.cpp.
PrivateData* QwtSpline::d_data [private] |
Reimplemented in QwtSplineCubic.
Definition at line 179 of file qwt_spline.h.