| 1 | /******************************************************************************
|
|---|
| 2 | * Qwt Widget Library
|
|---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
|---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
|---|
| 5 | *
|
|---|
| 6 | * This library is free software; you can redistribute it and/or
|
|---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
|---|
| 8 | *****************************************************************************/
|
|---|
| 9 |
|
|---|
| 10 | #ifndef QWT_SPLINE_LOCAL_H
|
|---|
| 11 | #define QWT_SPLINE_LOCAL_H
|
|---|
| 12 |
|
|---|
| 13 | #include "qwt_global.h"
|
|---|
| 14 | #include "qwt_spline.h"
|
|---|
| 15 |
|
|---|
| 16 | /*!
|
|---|
| 17 | \brief A spline with C1 continuity
|
|---|
| 18 |
|
|---|
| 19 | QwtSplineLocal offers several standard algorithms for interpolating
|
|---|
| 20 | a curve with polynomials having C1 continuity at the control points.
|
|---|
| 21 | All algorithms are local in a sense, that changing one control point
|
|---|
| 22 | only few polynomials.
|
|---|
| 23 | */
|
|---|
| 24 | class QWT_EXPORT QwtSplineLocal : public QwtSplineC1
|
|---|
| 25 | {
|
|---|
| 26 | public:
|
|---|
| 27 | /*!
|
|---|
| 28 | \brief Spline interpolation type
|
|---|
| 29 |
|
|---|
| 30 | All type of spline interpolations are lightweight algorithms
|
|---|
| 31 | calculating the slopes at a point by looking 1 or 2 points back
|
|---|
| 32 | and ahead.
|
|---|
| 33 | */
|
|---|
| 34 | enum Type
|
|---|
| 35 | {
|
|---|
| 36 | /*!
|
|---|
| 37 | A cardinal spline
|
|---|
| 38 |
|
|---|
| 39 | The cardinal spline interpolation is a very cheap calculation with
|
|---|
| 40 | a locality of 1.
|
|---|
| 41 | */
|
|---|
| 42 | Cardinal,
|
|---|
| 43 |
|
|---|
| 44 | /*!
|
|---|
| 45 | Parabolic blending is a cheap calculation with a locality of 1. Sometimes
|
|---|
| 46 | it is also called Cubic Bessel interpolation.
|
|---|
| 47 | */
|
|---|
| 48 | ParabolicBlending,
|
|---|
| 49 |
|
|---|
| 50 | /*!
|
|---|
| 51 | The algorithm of H.Akima is a calculation with a locality of 2.
|
|---|
| 52 | */
|
|---|
| 53 | Akima,
|
|---|
| 54 |
|
|---|
| 55 | /*!
|
|---|
| 56 | Piecewise Cubic Hermite Interpolating Polynomial (PCHIP) is an algorithm
|
|---|
| 57 | that is popular because of being offered by MATLAB.
|
|---|
| 58 |
|
|---|
| 59 | It preserves the shape of the data and respects monotonicity. It has a
|
|---|
| 60 | locality of 1.
|
|---|
| 61 | */
|
|---|
| 62 | PChip
|
|---|
| 63 | };
|
|---|
| 64 |
|
|---|
| 65 | QwtSplineLocal( Type type );
|
|---|
| 66 | virtual ~QwtSplineLocal();
|
|---|
| 67 |
|
|---|
| 68 | Type type() const;
|
|---|
| 69 |
|
|---|
| 70 | virtual uint locality() const QWT_OVERRIDE;
|
|---|
| 71 |
|
|---|
| 72 | virtual QPainterPath painterPath( const QPolygonF& ) const QWT_OVERRIDE;
|
|---|
| 73 | virtual QVector< QLineF > bezierControlLines( const QPolygonF& ) const QWT_OVERRIDE;
|
|---|
| 74 |
|
|---|
| 75 | // calculating the parametric equations
|
|---|
| 76 | virtual QVector< QwtSplinePolynomial > polynomials( const QPolygonF& ) const QWT_OVERRIDE;
|
|---|
| 77 | virtual QVector< double > slopes( const QPolygonF& ) const QWT_OVERRIDE;
|
|---|
| 78 |
|
|---|
| 79 | private:
|
|---|
| 80 | const Type m_type;
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | #endif
|
|---|