Loading...
Searching...
No Matches
qwt_spline.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_SPLINE_H
#define QWT_SPLINE_H
#include "qwt_global.h"
#include "qwt_spline.h"
class QwtSplineParametrization;
class QwtSplinePolynomial;
class QPainterPath;
class QLineF;
class QPolygonF;
#if QT_VERSION < 0x060000
template< typename T > class QVector;
#endif
class QWT_EXPORT QwtSpline
{
public:
enum BoundaryType
{
ConditionalBoundaries,
PeriodicPolygon,
ClosedPolygon
};
enum BoundaryPosition
{
AtBeginning,
AtEnd
};
enum BoundaryCondition
{
Clamped1,
Clamped2,
Clamped3,
LinearRunout
};
QwtSpline();
virtual ~QwtSpline();
void setParametrization( int type );
void setParametrization( QwtSplineParametrization* );
const QwtSplineParametrization* parametrization() const;
void setBoundaryType( BoundaryType );
BoundaryType boundaryType() const;
void setBoundaryValue( BoundaryPosition, double value );
double boundaryValue( BoundaryPosition ) const;
void setBoundaryCondition( BoundaryPosition, int condition );
int boundaryCondition( BoundaryPosition ) const;
void setBoundaryConditions( int condition,
double valueBegin = 0.0, double valueEnd = 0.0 );
virtual QPolygonF polygon( const QPolygonF&, double tolerance ) const;
virtual QPainterPath painterPath( const QPolygonF& ) const = 0;
virtual uint locality() const;
private:
Q_DISABLE_COPY(QwtSpline)
class PrivateData;
PrivateData* m_data;
};
class QWT_EXPORT QwtSplineInterpolating : public QwtSpline
{
public:
QwtSplineInterpolating();
virtual ~QwtSplineInterpolating();
virtual QPolygonF equidistantPolygon( const QPolygonF&,
double distance, bool withNodes ) const;
virtual QPolygonF polygon(
const QPolygonF&, double tolerance ) const QWT_OVERRIDE;
virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const = 0;
private:
Q_DISABLE_COPY(QwtSplineInterpolating)
};
class QWT_EXPORT QwtSplineG1 : public QwtSplineInterpolating
{
public:
QwtSplineG1();
virtual ~QwtSplineG1();
};
class QWT_EXPORT QwtSplineC1 : public QwtSplineG1
{
public:
QwtSplineC1();
virtual ~QwtSplineC1();
virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
virtual QPolygonF equidistantPolygon( const QPolygonF&,
double distance, bool withNodes ) const QWT_OVERRIDE;
// these methods are the non parametric part
virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const;
virtual QVector< double > slopes( const QPolygonF& ) const = 0;
virtual double slopeAtBeginning( const QPolygonF&, double slopeNext ) const;
virtual double slopeAtEnd( const QPolygonF&, double slopeBefore ) const;
};
class QWT_EXPORT QwtSplineC2 : public QwtSplineC1
{
public:
enum BoundaryConditionC2
{
CubicRunout = LinearRunout + 1,
NotAKnot
};
QwtSplineC2();
virtual ~QwtSplineC2();
virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
virtual QPolygonF equidistantPolygon( const QPolygonF&,
double distance, bool withNodes ) const QWT_OVERRIDE;
// calculating the parametric equations
virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
virtual QVector< double > curvatures( const QPolygonF& ) const = 0;
};
#endif
QVector
Definition qwt_clipper.h:23
QwtSplineC1
Base class for spline interpolations providing a first order parametric continuity ( C1 ) between adj...
Definition qwt_spline.h:236
QwtSplineC1::slopes
virtual QVector< double > slopes(const QPolygonF &) const =0
Find the first derivative at the control points.
QwtSplineC2
Base class for spline interpolations providing a second order parametric continuity ( C2 ) between ad...
Definition qwt_spline.h:268
QwtSplineC2::curvatures
virtual QVector< double > curvatures(const QPolygonF &) const =0
Find the second derivative at the control points.
QwtSplineC2::BoundaryConditionC2
BoundaryConditionC2
Definition qwt_spline.h:276
QwtSplineG1
Base class for spline interpolations providing a first order geometric continuity ( G1 ) between adjo...
Definition qwt_spline.h:217
QwtSpline
Base class for all splines.
Definition qwt_spline.h:58
QwtSpline::BoundaryPosition
BoundaryPosition
Definition qwt_spline.h:100
QwtSpline::AtBeginning
@ AtBeginning
the condition is at the beginning of the polynomial
Definition qwt_spline.h:102
QwtSpline::painterPath
virtual QPainterPath painterPath(const QPolygonF &) const =0
QwtSpline::BoundaryType
BoundaryType
Definition qwt_spline.h:66
QwtSpline::PeriodicPolygon
@ PeriodicPolygon
Definition qwt_spline.h:79
QwtSpline::ConditionalBoundaries
@ ConditionalBoundaries
Definition qwt_spline.h:72
QwtSpline::BoundaryCondition
BoundaryCondition
Boundary condition.
Definition qwt_spline.h:120
QwtSpline::Clamped2
@ Clamped2
Definition qwt_spline.h:134
QwtSpline::Clamped3
@ Clamped3
Definition qwt_spline.h:143
QwtSpline::Clamped1
@ Clamped1
Definition qwt_spline.h:125
QwtSplineInterpolating
Base class for a spline interpolation.
Definition qwt_spline.h:194
QwtSplineInterpolating::bezierControlLines
virtual QVector< QLineF > bezierControlLines(const QPolygonF &) const =0
Interpolate a curve with Bezier curves.
QwtSplineParametrization
Curve parametrization used for a spline interpolation.
Definition qwt_spline_parametrization.h:45
QwtSplinePolynomial
A cubic polynomial without constant term.
Definition qwt_spline_polynomial.h:31