The splines are a necessary element for everything that will follow. This is why we tried to make it as generic as possible. For this, we used a C++11 feature called \emph{variadic templates}. A spline is composed of control points (represented as C++ tuples), a nodes vector and degree. The class we made looks like this \begin{lstlisting}[language=c++] template class Spline { public: std::tuple operator()(float t); std::tuple prime(float t); private: std::vector> controlPoints; std::vector nodes; int degree; }; \end{lstlisting} We redefined the \texttt{operator()} to be able to \emph{evaluate} a spline at a certain time, and the result will be an object which is a barycenter of those control points. We also made a member function \texttt{prime} to be able to compute the derivative of a spline. The \texttt{operator()} computes the barycent of the control points like this $$C(t) = \sum_{i=0}^m P_i N_i^n(t)$$ where $(P_i)_{i\in [[0,m]]}$ are the $m+1$ control points, $n$ is the degree of the spline and $$N_i^0(t) = \left\{\begin{matrix}1&\text{if } t \in [t_i, t_{i+1}] \\ 0 & \text{otherwise} \end{matrix} \right.$$ $$ N_i^k(t) = \frac{t-t_i}{t_{i+k}-t_{i}} N_i^{k-1}(t) + \frac{t_{i+k+1} - t}{t_{i+k+1}-t_{i+1}} N_{i+1}^{k-1}(t) \quad\text{assuming} \quad \frac{0}{0} = 0$$ The \texttt{prime} member function computes the derivative like this $$C'(t) = \sum_{i=0}^m N_i^{\prime n} (t) P_i $$ with $$ N_i^{\prime n}(t) = \frac{n}{t_{i+n}-t_{i}}N_i^{n-1}(t) - \frac{n}{t_{i+n+1}-t_{i+1}}N_{i+1}^{n-1}(t)$$