| 1 |
#ifndef _Spline_h_ |
| 2 |
#define _Spline_h_ |
| 3 |
/* Spline.h |
| 4 |
* |
| 5 |
* Copyright (C) 1993-2020 David Weenink |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#define Spline_MAXIMUM_DEGREE 20 |
| 22 |
|
| 23 |
#include "Graphics.h" |
| 24 |
#include "Polynomial.h" |
| 25 |
#include "Spline_def.h" |
| 26 |
|
| 27 |
void Spline_init (Spline me, double xmin, double xmax, integer degree, integer numberOfCoefficients, integer numberOfKnots); |
| 28 |
|
| 29 |
integer Spline_getOrder (Spline me); |
| 30 |
|
| 31 |
void Spline_drawKnots (Spline me, Graphics g, double xmin, double xmax, double ymin, double ymax, bool garnish); |
| 32 |
|
| 33 |
autoSpline Spline_scaleX (Spline me, double xmin, double xmax); |
| 34 |
/* scale domain and knots to new domain */ |
| 35 |
|
| 36 |
Thing_define (MSpline, Spline) { |
| 37 |
// overridden methods: |
| 38 |
public: |
| 39 |
virtual double v_evaluate (double x); |
| 40 |
virtual void v_evaluateTerms (double x, VEC terms); |
| 41 |
}; |
| 42 |
|
| 43 |
autoMSpline MSpline_create (double xmin, double xmax, integer degree, integer numberOfInteriorKnots); |
| 44 |
|
| 45 |
autoMSpline MSpline_createWithCoefficients (double xmin, double xmax, integer degree, constVECVU const& coefficients, constVECVU const& interiorKnots); |
| 46 |
|
| 47 |
Thing_define (ISpline, Spline) { |
| 48 |
// overridden methods: |
| 49 |
public: |
| 50 |
virtual double v_evaluate (double x); |
| 51 |
virtual void v_evaluateTerms (double x, VEC terms); |
| 52 |
virtual integer v_getOrder (); |
| 53 |
}; |
| 54 |
|
| 55 |
autoISpline ISpline_create (double xmin, double xmax, integer degree, integer numberOfInteriorKnots); |
| 56 |
|
| 57 |
autoISpline ISpline_createWithCoefficients (double xmin, double xmax, integer degree, constVECVU const& coefficients, constVECVU const& interiorKnots); |
| 58 |
|
| 59 |
#endif /* _Spline_h_ */ |