How can I determine the convexity of an incomplete (i.e. non-watertight) trimesh? Convexity is well-defined even for incomplete meshes: Iff the incomplete trimesh T can be completed to a convex trimesh, T is convex. (I use the term "incomplete" over "non-watertight" because a. in my case it is a subset of an existing trimesh and b. because "non-watertight" includes cases of small errors/floating point inaccuracies, while I'm talking about missing patches of triangles, so I think "incomplete" is more evocative.)
I've tried to simply use Trimesh.is_convex
, but that always return False
for incomplete trimeshes. I thought about determining the convex hull of the point set and to check if it has the same number of points then the incomplete trimesh, but that is too lax. (As a 2D example, think of the letter Z: It's an incomplete polygon, which is non-convex by the above definition. But the points of the convex hull are identical to the original points.)
I'm thinking about the approach to calculate hashes for all triangles in the incomplete trimesh and for all triangles in its convex hull and then check for inclusion. But is there a conceptionally simpler/ more efficient way?