I'm generating a bunch of points inside a BoundaryMeshRegion. Then I generate the Voronoi mesh of the points, and take the intersection of the Voronoi cells into the region. How could I recover the adjacency of the resulting cells? The problem is that at the end I end up with a list of independent mesh cell regions, so I don't know how could I get the adjacency of the cells from the list.
What I'm doing below.
Take the following binary image:
myImage =
Get the mesh region:
myMeshRegion = ImageMesh[myImage]
Generate a bunch of points inside such region:
myPoints = RandomPoint[myMeshRegion, 100];
Show[{myMeshRegion, Graphics[Point[myPoints]]}]
Get the Voronoi mesh from the points:
myVoronoi = VoronoiMesh[myPoints]
Get the intersection of myMeshRegion and the cells in myVoronoi, using the method in this question.
myIntersectionCells = DeleteCases[
RegionIntersection[DiscretizeGraphics@#, myMeshRegion] & /@
MeshPrimitives[myVoronoi, 2], _RegionIntersection];
Show[myIntersectionCells]
By inspection, we can see that myIntersectionCells is a list of BoundaryMeshRegion elements, representing every "cell" in this mesh. So, from myIntersectionCells, can I get the MeshConnectivityGraph[]? Related to this question, how could I make myIntersectionCells a single mesh, instead of a list of mesh cells?
Thanks
P.S. I'm using MMA 12.2










allprimitivesbecause I had falsely assumed that each mesh inmyIntersectionCellswould consists of only a single polygon. I corrected it. Please have a look whether it works better for you now. – Henrik Schumacher Mar 10 '21 at 13:39MeshConnectivityGraphhas a bug. See my edit; I showed a workaround there. – Henrik Schumacher Mar 10 '21 at 19:27