As suggested in
Kindlmann
the curvature of a surface is defined by the relationship between positional changes in the neighborhood of a point placed on the surface and the change in the surface normal.
Given a level-set
$\Phi(\mathbf{x})$, we consider
that the value of the level-set is positive inside the
object, negative outside. Hence, we define the normal unit
vector:
\begin{equation}
\mathbf{n}=-\frac{\nabla \Phi}{|\nabla \Phi|}
\end{equation}
The curvature information is contained in the 3x3 matrix
$\nabla{\bf{n}^T}$. Considering the Hessian matrix:
\begin{equation}
\bf{H} =
\begin{bmatrix}
\frac{\partial^2\Phi}{\partial x^2}&
\frac{\partial \Phi}{\partial xy} &
\frac{\partial \Phi}{\partial xz} \\[1ex] % <-- 1ex more space between rows of matrix
\frac{\partial \Phi}{\partial xy} &
\frac{\partial^2\Phi}{\partial y^2} &
\frac{\partial \Phi}{\partial yz} \\[1ex]
\frac{\partial \Phi}{\partial xz} &
\frac{\partial \Phi}{\partial yz} &
\frac{\partial^2\Phi}{\partial z^2}
\end{bmatrix}
\end{equation}
The projection matrix is defined as
$\bf{P}=\bf{I}-\bf{n}\bf{n}^T$ and allows us to project the hessian on the tangent plane (we are interested only on the changement in the direction of the normal vector, not of the magnitude). We multiply
$\nabla{\bf{n}^T}$ by the projection matrix
$\bf{P}$, obtaining the Geometric tensor:
\begin{equation}
\bf{G}=\nabla{\bf{n}}^T\bf{P}
\end{equation}
The projection matrix, defined as
$\bf{P}=\bf{I}-\bf{n}\bf{n}^T$, projects the matrix on the tangent plane to the surface described by the function
$\Phi(\bf{x})=0$. As described in
Kindlmann it is possible to write the relationship:
\begin{equation}
\nabla {\mathbf{n}^T}=-\frac{1}{|{\nabla \Phi}|}(\bf{P}\bf{H})
\end{equation}
The Hessian matrix describes how the gradient changes around the neighborhood of the points placed on an iso-surface of the function
$\Phi(x)$. In order to describe the curvature we are interested only in changes of direction of the gradient. Hence we project
$\bf{H}$ on the tangent plane. The restriction of the Hessian to the tangent plane is a symmetric matrix and it is possible to find an orthonormal basis
$\{\bf{p}_1,\bf{p}_2,\bf{n}\}$ able to diagonalize the
matrix. In this basis we will obtain:
\begin{equation}
\nabla {\bf{n}^T}=
\begin{bmatrix}
k_1&
0 &
\sigma_1 \\[1ex] % <-- 1ex more space between rows of matrix
0 &
k_2 &
\sigma_2 \\[1ex]
0 &
0 &
0
\end{bmatrix}
\end{equation}
$\bf{p}_1$ and
$\bf{p}_2$ are the two eigenvectors associated to the principal curvatures, with eigenvalues
$k_1$ and
$k_2$. The other two values
$\sigma_1$ and
$\sigma_2$ describe how the normal tilts. This aspect is called flowline curvature.
All of this to say that I would search numerically the eigenvectors of the projected Hessian Matrix through an eigenvalues-eigenvector identification algorithm. For example in python you have the function eig of the library numpy. This would give you the eigenvectors of the principal direction.