X-Git-Url: http://git.tdb.fi/?p=libs%2Fmath.git;a=blobdiff_plain;f=source%2Finterpolate%2Fspline.h;fp=source%2Finterpolate%2Fspline.h;h=c801188e695cfb4f1c6a51c75368332ad5af53e9;hp=67c8df07d9b9e24904b868ab1950762d7d95c58c;hb=23583f28679d722e7354c1aa9951731e3dc79726;hpb=4b895388d12b160f486c8b49b3296b15eeed7cc2 diff --git a/source/interpolate/spline.h b/source/interpolate/spline.h index 67c8df0..c801188 100644 --- a/source/interpolate/spline.h +++ b/source/interpolate/spline.h @@ -3,6 +3,7 @@ #include #include +#include "knot.h" #include "polynomial.h" namespace Msp { @@ -24,6 +25,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 +51,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 {