X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finterpolate%2Fspline.h;h=88626d2358c5fb5cd2e6756c5c43de4c9556b6b9;hb=1d33efd177208ed449b6333539bf13e4ffc93b97;hp=67c8df07d9b9e24904b868ab1950762d7d95c58c;hpb=4b895388d12b160f486c8b49b3296b15eeed7cc2;p=libs%2Fmath.git diff --git a/source/interpolate/spline.h b/source/interpolate/spline.h index 67c8df0..88626d2 100644 --- a/source/interpolate/spline.h +++ b/source/interpolate/spline.h @@ -2,7 +2,7 @@ #define MSP_INTERPOLATE_SPLINE_H_ #include -#include +#include "knot.h" #include "polynomial.h" namespace Msp { @@ -24,6 +24,17 @@ struct SplineValue static Type make(const T *v) { return *v; } }; +template +struct SplineKnot +{ + typedef typename SplineValue::Type Value; + T x; + Value y; + + SplineKnot(): x(T()) { } + SplineKnot(T x_, const Value &y_): x(x_), y(y_) { } +}; + /** Stores a spline of degree D. It is a piecewise polynomial function with value continuity. Derivatives are not guaranteed to be continuous. @@ -39,15 +50,7 @@ class Spline { public: typedef typename SplineValue::Type Value; - - struct Knot - { - T x; - Value y; - - Knot(): x(T()) { } - Knot(T x_, const Value &y_): x(x_), y(y_) { } - }; + typedef SplineKnot Knot; struct Segment {