
#include "../geometry/spline.h"
#include "debug.h"

template <typename T>
T Spline<T>::cubic_unit_spline(float time, const T &position0, const T &position1,
                               const T &tangent0, const T &tangent1) {

    // TODO (Animation): Task 1a
    // Given time in [0,1] compute the cubic spline coefficients and use them to compute
    // the interpolated value at time 'time' based on the positions & tangenets

    // Note that Spline is parameterized on type T, which allows us to create splines over
    // any type that supports the * and + operators.

    return T();
}

template <typename T> T Spline<T>::at(float time) const {

    // TODO (Animation): Task 1b

    // Given a time, find the nearest positions & tangent values
    // defined by the control point map.

    // Transform them for use with cubic_unit_spline

    // Be wary of edge cases! What if time is before the first knot,
    // before the second knot, etc...

    return cubic_unit_spline(0.0f, T(), T(), T(), T());
}
