Suppose we want to interpolate between (n) control point with known slope and known time. in this case we have (n-1) curves in which, each pair of control points represents one segment of the curve and each curve segment is a cubic polynomial with its own coefficients.
This code calculate coefficients of each curves and interpolate according to time.
For example you can use main