I have a mesh and in the region around each triangle, I want to compute an estimate of the principal curvature directions. I have never done this sort of thing before and Wikipedia does not help a lot. Can you describe or point me to a simple algorithm that can help me compute this estimate?Assume that I know positions and normals of all vertices.
What is the simplest way to compute principal curvature for a mesh triangle?
mesh
When I needed an estimate of mesh curvature for a skin shader, the algorithm I ended up settling on was this:First, I computed a scalar curvature for each edge in the mesh. If the edge has positions $p_0, p_1$ and normals $n_0, n_1$, then I estimated its curvature as:$$\frac{(n_1 - n_0) \cdot (p_1 - p_0)}{(p_1 - p_0)^2}$$This calculates the difference in normals, projected along the edge, as a fraction of the length of the edge. You can verify that if applied to two points on a circle of radius $r$, this gives the correct curvature $1/r$. It also correctly gives a negative curvature if you invert the normals.Then, for each vertex I looked at the curvatures of all the edges touching it. In my case, I just wanted a scalar estimate of average curvature, so I ended up taking the geometric mean of the absolute values of all the edge curvatures at each vertex. For your case, you might find the minimum and maximum curvatures, and take those edges to be the principal curvature directions (maybe orthonormalizing them with the vertex normal). That's a bit rough, but it might give you a good enough result for what you want to do.Another approach I can imagine using, but haven't tried, would be to estimate the second fundamental form of the surface at each vertex. This could be done by setting up a tangent basis at the vertex, then converting all neighboring vertices into that tangent space, and using least-squares to find the best-fit 2FF matrix. Then the principal curvature directions would be the eigenvectors of that matrix. This seems interesting as it could let you find curvature directions implied by the neighboring vertices without any edges explicitly pointing in those directions, but on the other hand is a lot more code, more computation, and perhaps less numerically robust.