Iteratively placing points along a spline/evenly spacing them. CPP

Hello!

Currently working on a tool to auto generate spline components. Points are gathered from an array of coordinates and then passed to a spline component that is then spawned in the level. For the most part this works smoothly, except for the problem that sometimes, the points are too close together, resulting in loops/curves that aren’t wanted, e.g.

loop

Pulling the points apart results in the spline straightening, which is the desired behavior.

How can I space these points along the spline consistently, to avoid this behavior?

I tried to perform an arc-length parameterization of the curve the spline represents, but either my implementation was incorrect (still taking a look at that) or that isn’t the solution here.

Any tips would be appreciated.

Answered my own question.

The arc length parameterization was incorrect. Fixing it solved the issue. Anyone who stumbles across this same problem would be helped by checking out the following: