# Mesh/grid over convex polytope

**URL:** <https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047>\
**Category:** Numerics\
**Tags:** question, polygons, convex-hull\
**Created:** [March 16, 2020, 4:30pm UTC](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047 "2020-03-16T16:30:24Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 17, 2020, 8:10am UTC](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047/6 "2020-03-17T08:10:54Z")

</div>

> [@PetrKryslUCSD](#):
>
> Why do you need it? For interpolation, or integration?

For simplifying a simulation, as described [here](https://discourse.julialang.org/t/simplifying-simulation-by-clusters/35870).

> [@PetrKryslUCSD](#):
>
> How about tiling the convex hull with tetrahedra (Delaunay) and then distributing the job across these tetrahedra?

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):

 ![grid2](https://global.discourse-cdn.com/julialang/original/3X/a/6/a60c8f5dab4acf0beb973a653e2fbe2cc2c3a2e4.png)

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).

---

_[View the full topic](https://discourse.julialang.org/t/mesh-grid-over-convex-polytope/36047)._
