I have coordinates of a set of points that form a closed loop that lies in a 3D surface. I know the equation of the surface and I can calculate it's surface normal at any point. I found that for a unit speed curve $\alpha(t)$ I can calculate the geodesic curvature as $$ \kappa_g(t) = \alpha''(t)\cdot (n(t)\times\alpha'(t)) $$
where $n(t)$ is the surface normal. I am confused about how to calculate the unit-speed derivatives $\alpha'(t)$ and $\alpha''(t)$. I think I should use some finite difference scheme like $$ \alpha'(t) \approx \frac{\alpha(t + h) - \alpha(t - h)}{2h} $$
So my algorithm for calculating the geodesic curvature at any point $P$ of this curve should be as follows:
- Identify a reference point on the curve to measure arc-length from.
- For the point $P$ calculate the arc-length by adding up the Euclidean distances between successive points from the reference point to the point P. This arc length gives me $t$.
- Find the position vectors of points at $t + h$ and $t - h$ by interpolation and then use the above finite difference equation to calculate $\alpha'(t)$.
Is my algorithm correct? I am not clear about how to get arc-length parameterization from the points on the curve.
Are there any standard algorithms (or even Python libraries) for such a calculation?
UPDATE 1: I implemented @Futurologist 's wonderful answer for the test case of a circle on a cone as shown below
I get the Frenet-Serret frame along the circle as shown below
The total curvature at each point on the circle is $k_i = 1.0$ which is correct because I designed the circle to have a radius of $1.0$. I get the geodesic curvature at all points as $-1/\sqrt{2}$. So everything looks good. Can someone confirm if the sign of the geodesic curvature or the $N_i$ vectors in the TNB frames are correct? I know that I can flip it by changing the order in the cross-product for $b_i$ but I am asking if there are is standard convention.
UPDATE 2: I had to use $b_i = (\alpha_{i} - \alpha_{i-1})\times(\alpha_{i+1} - \alpha_i)$ to get the correct sign for $N_i$ and a right-handed TNB frame. Also at some of the points the tangent $T_i$ was pointing in the opposite direction of the increasing arc-length parameter due to angle between $b_i$ and $n_i$ increasing above $\pi$. In those cases, I had to flip the $T_i$. Now I get the geodesic curvature at all points as $1/\sqrt{2}$ and the vectors $N_i$ point inwards as desired.