X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finterpolate%2Fspline.h;h=d76197930e5747e7a93e05137309ffeccf2ae5d1;hb=acdb569a0370162ffc282b2e43221f34e35e7c58;hp=67c8df07d9b9e24904b868ab1950762d7d95c58c;hpb=4b895388d12b160f486c8b49b3296b15eeed7cc2;p=libs%2Fmath.git diff --git a/source/interpolate/spline.h b/source/interpolate/spline.h index 67c8df0..d761979 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 { @@ -131,6 +134,8 @@ inline Spline &Spline::operator=(const Spline &s) capacity = 0; segments = 0; } + + return *this; } template