[Bf-committers] Mesh curvature estimation

Nicholas Bishop nicholasbishop at gmail.com
Mon Nov 28 01:38:53 CET 2011

Hi all,

A few times I've run into algorithms that require principal curvatures
[1] as inputs. My cursory examination of the Blender source (basically
just grepping for "curvature") didn't turn up any code for this, so I
ported the (GPLv2) curvature code from the trimesh2 lib [2] to
Blender. That code is based on the paper "Estimating Curvatures and
Their Derivatives on Triangle Meshes" [3]. Dunno if this is useful to
anyone else, but I've pushed a Blender branch [4] containing the
curvature calculation (in blenlib/intern/curvature.c), as well as a
test modifier that displays the curvature vectors.

Screenshot with Suzanne: http://www.pasteall.org/pic/show.php?id=21557

The original code was in C++; I converted it to C and switched the
math stuff over to blenlib and the types to MVert/MFace/etc. The
per-vertex output is the two principal curvatures and two direction
vectors. I haven't updated the code to handle quads yet, it'll
assert() if it encounters a non-triangle face. I've only just gotten
this working, so there are definitely bugs in it yet. :)


[1] http://en.wikipedia.org/wiki/Principal_curvature
[2] http://gfx.cs.princeton.edu/proj/trimesh2/
[3] http://gfx.cs.princeton.edu/pubs/_2004_ECA/
[4] https://gitorious.org/~nicholasbishop/blenderprojects/nicholasbishop-blender/commits/tri-curvature

More information about the Bf-committers mailing list