There is a small difference between spline and Bezier curves and Catmull-Rom curves. If Bezier curves are what you’re after, there is a code that lets you calculate the point along an arbitrary number of control points:
// https://stackoverflow.com/questions/785097/how-do-i-implement-a-bézier-curve-in-c
vector_4 getBezierPoint(vector<vector_4> points, float t)
{
int i = points.size() - 1;
while (i > 0)
{
for (int k = 0; k < i; k++)
{
points[k].x += t * (points[k + 1].x - points[k].x);
points[k].y += t * (points[k + 1].y - points[k].y);
points[k].z += t * (points[k + 1].z - points[k].z);
points[k].w += t * (points[k + 1].w - points[k].w);
}
i--;
}
return points[0];
}
Does this help? If not, and you’re super desperate to have a spline, then check out the following header-only library. Works great for me!
Especially see this test file for how to use the library: