Mesh/grid over convex polytope

For simplifying a simulation, as described here.

Tetrahedra could be a good idea, but maybe V-D would not be a good match: I want to keep it as regular as feasible.

Here is what I came up with (2D illustration, but remember the problem is 3D):

  1. Find the facets [F, blue]
  2. Using the “center of mass” [C, red], (could be weighted, all that matters is that it is a nice interior point that gives more or less balanced partition below)
  3. Partition the convex hull into simplexes (tetrahedra), [red lines]
  4. Cut each simplex into self-similar pieces, effectively getting d^n subcells.

This would give me a very fast and simple way to do everything using barycentric coordinates once I determine the relevant simplex.

I can implement most of this, except finding the facets of the convex hull. Help with this would be appreciated — I don’t need the most efficient algorithm, in fact I am happy to brute force this with something O(n^2). I am just hoping that building blocks exist within Julia so that I don’t have to figure this out from first principles or learn the relevant geometry (again, it is fascinating, but not my field).