I have a list of line segments that run through a track model and I am looking to achieve two things:
- smooth the overall shape of the path
- being able to evaluate a position by querying from
I have implemented Catmull-Rom spline using the
TreeSpline class from Unity (it's not explicitly in the docs but you can see it here), it does work except for one thing: some places have overshoot:
- purple: original line segments
- white: result of the
After searching for a bit, it appears that Monotone cubic interpolation would be a solution to my problem. However, the formulas only show on how to do with 2D points, not with 3D points which I'm using.
How can I adapt the formulas in the Wikipedia article to 3D points instead ?
(I am also open to alternative approaches)
Thanks to @Jay it's better now: