QWT 7.0.1
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
QwtSpline Class Referenceabstract

Base class for all splines. More...

#include <qwt_spline.h>

Inheritance diagram for QwtSpline:
QwtSplineBasis QwtSplineInterpolating QwtSplineG1 QwtSplineC1 QwtSplinePleasing QwtSplineC2 QwtSplineLocal QwtSplineCubic

Classes

class  PrivateData
 

Public Types

enum  BoundaryType { ConditionalBoundaries , PeriodicPolygon , ClosedPolygon }
 Boundary type specifying the spline at its endpoints. More...
 
enum  BoundaryPosition { AtBeginning , AtEnd }
 position of a boundary condition More...
 
enum  BoundaryCondition { Clamped1 , Clamped2 , Clamped3 , LinearRunout }
 Boundary condition. More...
 

Public Member Functions

 QwtSpline ()
 Constructor.
 
virtual ~QwtSpline ()
 Destructor.
 
void setParametrization (int type)
 Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.
 
void setParametrization (QwtSplineParametrization *)
 Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.
 
const QwtSplineParametrizationparametrization () const
 
void setBoundaryType (BoundaryType)
 Define the boundary type for the endpoints of the approximating spline.
 
BoundaryType boundaryType () const
 
void setBoundaryValue (BoundaryPosition, double value)
 Define the boundary value.
 
double boundaryValue (BoundaryPosition) const
 
void setBoundaryCondition (BoundaryPosition, int condition)
 Define the condition for an endpoint of the spline.
 
int boundaryCondition (BoundaryPosition) const
 
void setBoundaryConditions (int condition, double valueBegin=0.0, double valueEnd=0.0)
 Define the condition at the endpoints of a spline.
 
virtual QPolygonF polygon (const QPolygonF &, double tolerance) const
 Interpolate a curve by a polygon.
 
virtual QPainterPath painterPath (const QPolygonF &) const =0
 Approximates a polygon piecewise with cubic Bezier curves and returns them as QPainterPath.
 
virtual uint locality () const
 The locality of an spline interpolation identifies how many adjacent polynomials are affected, when changing the position of one point.
 

Detailed Description

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.

Member Enumeration Documentation

◆ BoundaryCondition

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.

See also
boundaryCondition(), boundaryValue()
QwtSplineC2::BoundaryConditionC2
Enumerator
Clamped1 

The first derivative at the end point is given.

See also
boundaryValue()
Clamped2 

The second derivative at the end point is given.

See also
boundaryValue()
Note
a condition having a second derivative of 0 is also called "natural".
Clamped3 

The third derivative at the end point is given.

See also
boundaryValue()
Note
a condition having a third derivative of 0 is also called "parabolic runout".
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.

See also
boundaryValue().

◆ BoundaryPosition

position of a boundary condition

See also
boundaryCondition(), boundaryValue()
Enumerator
AtBeginning 

the condition is at the beginning of the polynomial

AtEnd 

the condition is at the end of the polynomial

◆ BoundaryType

Boundary type specifying the spline at its endpoints.

See also
setBoundaryType(), boundaryType()
Enumerator
ConditionalBoundaries 

The polynomials at the start/endpoint depend on specific conditions.

See also
QwtSpline::BoundaryCondition
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.

Note
Only works for parametrizations, where the parameter increment for the the final closing line is positive. This excludes QwtSplineParametrization::ParameterX and QwtSplineParametrization::ParameterY

Constructor & Destructor Documentation

◆ QwtSpline()

QwtSpline::QwtSpline ( )

Constructor.

The default setting is a non closing spline with chordal parametrization

See also
setParametrization(), setBoundaryType()

Member Function Documentation

◆ boundaryCondition()

int QwtSpline::boundaryCondition ( BoundaryPosition  position) const
Returns
Condition for an endpoint of the spline
Parameters
positionAt the beginning or the end of the spline
See also
setBoundaryCondition(), boundaryValue(), setBoundaryConditions()

◆ boundaryType()

QwtSpline::BoundaryType QwtSpline::boundaryType ( ) const
Returns
Boundary type
See also
setBoundaryType()

◆ boundaryValue()

double QwtSpline::boundaryValue ( BoundaryPosition  position) const
Returns
Boundary value
Parameters
positionAt the beginning or the end of the spline
See also
setBoundaryValue(), boundaryCondition()

◆ locality()

uint QwtSpline::locality ( ) const
virtual

The locality of an spline interpolation identifies how many adjacent polynomials 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 polynomials. Those polynomials 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 polynomials ( f.e cubic splines ).

Returns
Order of locality

Reimplemented in QwtSplineBasis, QwtSplineCubic, QwtSplineLocal, and QwtSplinePleasing.

◆ painterPath()

QPainterPath QwtSpline::painterPath ( const QPolygonF &  points) const
pure virtual

Approximates a polygon piecewise with cubic Bezier curves and returns them as QPainterPath.

Parameters
pointsControl points
Returns
Painter path, that can be rendered by QPainter
See also
polygon(), QwtBezier

Implemented in QwtSplineInterpolating, QwtSplineC1, QwtSplineC2, QwtSplineBasis, QwtSplineCubic, QwtSplineLocal, and QwtSplinePleasing.

◆ parametrization()

const QwtSplineParametrization * QwtSpline::parametrization ( ) const
Returns
parametrization
See also
setParametrization()

◆ polygon()

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 )

Parameters
pointsControl points
toleranceMaximum for the accepted error of the approximation
Returns
polygon approximating the interpolating polynomials
See also
bezierControlLines(), QwtBezier

Reimplemented in QwtSplineInterpolating.

◆ setBoundaryCondition()

void QwtSpline::setBoundaryCondition ( BoundaryPosition  position,
int  condition 
)

Define the condition for an endpoint of the spline.

Parameters
positionAt the beginning or the end of the spline
conditionCondition
See also
BoundaryCondition, QwtSplineC2::BoundaryCondition, boundaryCondition()

◆ setBoundaryConditions()

void QwtSpline::setBoundaryConditions ( int  condition,
double  valueBegin = 0.0,
double  valueEnd = 0.0 
)

Define the condition at the endpoints of a spline.

Parameters
conditionCondition
valueBeginUsed for the condition at the beginning of te spline
valueEndUsed for the condition at the end of te spline
See also
BoundaryCondition, QwtSplineC2::BoundaryCondition, testBoundaryCondition(), setBoundaryValue()

◆ setBoundaryType()

void QwtSpline::setBoundaryType ( BoundaryType  boundaryType)

Define the boundary type for the endpoints of the approximating spline.

Parameters
boundaryTypeBoundary type
See also
boundaryType()

◆ setBoundaryValue()

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.

Parameters
positionAt the beginning or the end of the spline
valueValue used for the condition at the end point
See also
boundaryValue(), setBoundaryCondition()

◆ setParametrization() [1/2]

void QwtSpline::setParametrization ( int  type)

Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.

Parameters
typeType of parametrization, usually one of QwtSplineParametrization::Type
See also
parametrization()

◆ setParametrization() [2/2]

void QwtSpline::setParametrization ( QwtSplineParametrization parametrization)

Define the parametrization for a parametric spline approximation The default setting is a chordal parametrization.

Parameters
parametrizationParametrization
See also
parametrization()

The documentation for this class was generated from the following files: