# Estimating the curvature of a discretized curve in 3d with cubic splines

I have a computer simulation in which I'm modeling a physical curve by discretizing it and updating the locations of these points. I want to find/estimate the location of the maximum curvature of the curve and it seems like a way to approach this is to try and calculate which discretized point has maximum curvature. Note, I never have an actual curve, just the discretized points that are suppose to be representing the curve.

So far, the approach I have been thinking about is to estimate the curvature by interpolationg the points with cubic splines and then finding the curvature of the spline at each point. If you think there is a better approach, please let me know, but my questions below will be assuming this approach.

My first question is in setting up the cubic splines. Previously, I have only done it for scalar functions of one variable, but the points in question lie on a 3d space curve. The approach I would be inclined to take is to treat the curve parametrically as $\langle x(t), y(t), z(t) \rangle$ and then apply the 1d cubic spline algorithm I know to each component function. Finally, I would apply the curvature formula

$\frac{\sqrt{(z''y'-y''z')^2 + (x''z' - z''x')^2 + (y''x'-x''y')^2}}{(x'^2+y'^2+z'^2)^{3/2}}$

from wikipedia (https://en.wikipedia.org/wiki/Curvature#Curvature_of_space_curves) at each of the discretized point and find the maximum.

Does this seem like a valid approach? Do you think there is an approach that would be better?

## 1 Answer

Of course, your way will work. The only thing matters is whether it is going to be fast enough.

To create a cubic spline interpolating $$N$$ points, you can go with a global approach or a local approach. The global approach (such as the natural cubic spline) will need to solve an $$N$$ x $$N$$ matrix but will give you a $$C^2$$ continuous spline. The local approach (such as Catmull-Rom spline) is much faster performance wise (no need to solve a matrix) but will only give you a $$C^1$$ continuous spline (which will have $$C^2$$ discontinuity at the data points). You certainly don't want to have a spline that has $$C^2$$ discontinuity at the data points where you want to estimate curvature. However, solving an $$N$$ x $$N$$ matrix might become too slow for your purpose. So, there are a few alternatives here:

1. Use finite difference to estimate the first derivative and second derivative at each data point, then compute curvature from them.
2. Fit a circular arc thru each 3 consecutive data points $$P_{i-1}$$, $$P_i$$ and $$P_{i+1}$$ and use $$1/radius$$ as the curvature at $$P_i$$.

Each method will have different computation cost and result in different estimate for curvatures. You just have to find out which one suits you the best on your own.