38 Spline(
const std::vector<double> &t,
39 const std::vector<SplinePair> &xy,
53 double &aUntranslated,
54 double &bUntranslated,
55 double &cUntranslated,
56 double &dUntranslated)
const;
61 int numIterations)
const;
83 void checkTIncrements (
const std::vector<double> &t)
const;
85 void computeCoefficientsForIntervals (
const std::vector<double> &t,
86 const std::vector<SplinePair> &xy);
87 void computeControlPointsForIntervals ();
90 std::vector<SplineCoeff> m_elements;
93 std::vector<double> m_t;
96 std::vector<SplinePair> m_xy;
99 std::vector<SplinePair> m_p1;
100 std::vector<SplinePair> m_p2;
Single X/Y pair for cubic spline interpolation initialization and calculations.
friend class TestSpline
For unit testing.
SplinePair p2(unsigned int i) const
Bezier p2 control point for specified interval. P0 is m_xy[i] and P3 is m_xy[i+1].
SplinePair interpolateControlPoints(double t) const
Return interpolated y for specified x, for testing.
SplinePair findSplinePairForFunctionX(double x, int numIterations) const
Use bisection algorithm to iteratively find the SplinePair interpolated to best match the specified x...
Spline(const std::vector< double > &t, const std::vector< SplinePair > &xy, SplineTCheck splineTCheck=SPLINE_ENABLE_T_CHECK)
Initialize spline with independent (t) and dependent (x and y) value vectors.
SplinePair p1(unsigned int i) const
Bezier p1 control point for specified interval. P0 is m_xy[i] and P3 is m_xy[i+1].
void computeUntranslatedCoefficients(double aTranslated, double bTranslated, double cTranslated, double dTranslated, double tI, double &aUntranslated, double &bUntranslated, double &cUntranslated, double &dUntranslated) const
From coefficients in xy=d*(t-ti)^3+c*(t-ti)^2+b*(t-ti)+a we compute and return the coefficients in xy...
SplinePair interpolateCoeff(double t) const
Return interpolated y for specified x.