Commit 0ac8532c authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

Spline

- added function to evaluate spline using a single evaluation point
parent 43a7a87f
......@@ -29,8 +29,12 @@ namespace ITABase
{
//! Uses cubic splines to create a piecewise polynomial (order 3) for the given data pairs vdSupportingPoints and vdDataPoints. vdSupportingPoints need to be sorted in ascending order
ITA_BASE_API CPiecewisePolynomial CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints);
//! Uses cubic splines to create a piecewise polynomial (order 3) for the given data pairs vdSupportingPoints and vdDataPoints. Evaluates that Polynom at vdCostumPoints. vdSupportingPoints need to be sorted in ascending order.
ITA_BASE_API std::vector<float> CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, const std::vector<float>& vdCostumPoints);
//! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a vector of points
ITA_BASE_API std::vector<float> CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, const std::vector<float>& vdEvalPoints);
//! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a single point
ITA_BASE_API float CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, float dEvalPoint);
}
}
......
......@@ -82,9 +82,15 @@ CPiecewisePolynomial Math::CubicSpline(const std::vector<float>& vdSupportingPoi
return CPiecewisePolynomial(vdSupportingPoints, vdCoefficients, iPolynomialOrder);
}
std::vector<float> Math::CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, const std::vector<float>& vdCostumPoints)
std::vector<float> Math::CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, const std::vector<float>& vdEvalPoints)
{
CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints);
return myPoly.Value(vdCostumPoints);
return myPoly.Value(vdEvalPoints);
}
float Math::CubicSpline(const std::vector<float>& vdSupportingPoints, const std::vector<float>& vdDataPoints, float dEvalPoint)
{
CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints);
return myPoly.Value(dEvalPoint);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment