1

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?

Jann Poppinga
  • 444
  • 4
  • 18
  • *Iff the incomplete trimesh T can be completed to a convex trimesh, T is convex.* - that sounds nice, but from the top of my head it brings up at least two questions: 1) Can you do such completion? 2) Are there multiple ways to complete such mesh, some convex, some concave? – tevemadar Jan 08 '21 at 11:09
  • @tevemadar Re 1) I don't want to construct it, this is just for the sake of the definition. And even so, I struggle to find an example where the convex hull would not be that completion. 2) Of course, as soon as the hole is big enough. My definition only demands one complex completion for T to be complex. – Jann Poppinga Jan 08 '21 at 13:40

1 Answers1

0

One solution - not particularly fast, not particularly elegant - is to determine the convex hull of the incomplete mesh T and then calculate the distance of all vertices of T and of all face centroids of T to the convex hull. If all distances are (within floating point accuracy range of) 0, T is convex.

Jann Poppinga
  • 444
  • 4
  • 18