qwt_spline.h
Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_SPLINE_H
00011 #define QWT_SPLINE_H 1
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_spline.h"
00015 #include "qwt_spline_polynomial.h"
00016 #include <qpolygon.h>
00017 #include <qpainterpath.h>
00018 #include <qmath.h>
00019 
00020 class QwtSplineParametrization;
00021 
00053 class QWT_EXPORT QwtSpline
00054 {
00055 public:
00061     enum BoundaryType
00062     {
00068         ConditionalBoundaries,
00069 
00075         PeriodicPolygon,
00076 
00088         ClosedPolygon
00089     };
00090 
00095     enum BoundaryPosition
00096     {
00098         AtBeginning,
00099 
00101         AtEnd
00102     };
00103 
00115     enum BoundaryCondition
00116     {
00121         Clamped1,
00122         
00130         Clamped2,
00131         
00139         Clamped3,
00140 
00149         LinearRunout
00150     };  
00151 
00152     QwtSpline();
00153     virtual ~QwtSpline();
00154 
00155     void setParametrization( int type );
00156     void setParametrization( QwtSplineParametrization * );
00157     const QwtSplineParametrization *parametrization() const;
00158 
00159     void setBoundaryType( BoundaryType );
00160     BoundaryType boundaryType() const;
00161 
00162     void setBoundaryValue( BoundaryPosition, double value );
00163     double boundaryValue( BoundaryPosition ) const; 
00164     
00165     void setBoundaryCondition( BoundaryPosition, int condition );
00166     int boundaryCondition( BoundaryPosition ) const;
00167 
00168     void setBoundaryConditions( int condition,
00169         double valueBegin = 0.0, double valueEnd = 0.0 );
00170 
00171     virtual QPolygonF polygon( const QPolygonF &, double tolerance ) const;
00172     virtual QPainterPath painterPath( const QPolygonF & ) const = 0;
00173 
00174     virtual uint locality() const;
00175 
00176 private:
00177     Q_DISABLE_COPY(QwtSpline)
00178 
00179     class PrivateData;
00180     PrivateData *d_data;
00181 };
00182 
00189 class QWT_EXPORT QwtSplineInterpolating: public QwtSpline
00190 {
00191 public:
00192     QwtSplineInterpolating();
00193     virtual ~QwtSplineInterpolating();
00194 
00195     virtual QPolygonF equidistantPolygon( const QPolygonF &, 
00196         double distance, bool withNodes ) const;
00197 
00198     virtual QPolygonF polygon( const QPolygonF &, double tolerance ) const;
00199 
00200     virtual QPainterPath painterPath( const QPolygonF & ) const;
00201     virtual QVector<QLineF> bezierControlLines( const QPolygonF &points ) const = 0;
00202 
00203 private:
00204     Q_DISABLE_COPY(QwtSplineInterpolating)
00205 };
00206 
00211 class QWT_EXPORT QwtSplineG1: public QwtSplineInterpolating
00212 {           
00213 public:     
00214     QwtSplineG1();
00215     virtual ~QwtSplineG1();
00216 };
00217 
00230 class QWT_EXPORT QwtSplineC1: public QwtSplineG1
00231 {
00232 public:
00233     QwtSplineC1();
00234     virtual ~QwtSplineC1();
00235 
00236     virtual QPainterPath painterPath( const QPolygonF & ) const;
00237     virtual QVector<QLineF> bezierControlLines( const QPolygonF & ) const;
00238 
00239     virtual QPolygonF equidistantPolygon( const QPolygonF &,
00240         double distance, bool withNodes ) const;
00241 
00242     // these methods are the non parametric part
00243     virtual QVector<QwtSplinePolynomial> polynomials( const QPolygonF & ) const;
00244     virtual QVector<double> slopes( const QPolygonF & ) const = 0;
00245 
00246     virtual double slopeAtBeginning( const QPolygonF &, double slopeNext ) const;
00247     virtual double slopeAtEnd( const QPolygonF &, double slopeBefore ) const;
00248 };
00249 
00262 class QWT_EXPORT QwtSplineC2: public QwtSplineC1
00263 {
00264 public:
00270     enum BoundaryConditionC2
00271     {
00278         CubicRunout = LinearRunout + 1, 
00279 
00287         NotAKnot
00288     };
00289 
00290     QwtSplineC2();
00291     virtual ~QwtSplineC2();
00292 
00293     virtual QPainterPath painterPath( const QPolygonF & ) const;
00294     virtual QVector<QLineF> bezierControlLines( const QPolygonF & ) const;
00295 
00296     virtual QPolygonF equidistantPolygon( const QPolygonF &,
00297         double distance, bool withNodes ) const;
00298 
00299     // calculating the parametric equations
00300     virtual QVector<QwtSplinePolynomial> polynomials( const QPolygonF & ) const;
00301     virtual QVector<double> slopes( const QPolygonF & ) const;
00302     virtual QVector<double> curvatures( const QPolygonF & ) const = 0;
00303 };
00304 
00305 #endif


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:56