I have a set of Voronoi cells that I partition into some defined regions. I would like to then calculate the length of the "borders" between these adjacent regions, using the edges of the underlying Voronoi cells that constitute each region.
Suppose I have points Ps
:
Ps = {{-0.025, -0.34},
{0.29, -0.11}, {0.31, 0.83}, {-0.76, 0.76}, {0.73, 0.13}, {-0.36, 0.13}, {-0.47, 0.84}, {-0.73, 0.10}, {-0.91, -0.65}, {0.73, -0.27}, {0.98, 0.71}, {-0.37, 0.25}, {-0.53, -0.08}, {-0.49, 0.06}, {-0.52, 0.34}};
Then I group them into 4 regions:
R1 = {2, 13, 6, 9};
R2 = {10, 4, 11, 5, 3};
R3 = {14, 12, 15};
R4 = {1, 7, 8};
We visualize the Voronoi Mesh Vm
with these 4 regions:
Vm = VoronoiMesh[Ps, {-1, 1}, MeshCellLabel -> {2 -> "Index"},
MeshCellStyle -> {{2, R1} -> LightOrange, {2, R2} ->
LightBlue, {2, R3} -> LightYellow, {2, R4} -> LightPink}]
How could I compute the perimeter length of each "border"?
For instance, what's the perimeter length of the Organge-Yellow border? (and so on, for all region borders).
I know we can compute individual Mesh-cell perimeters (e.g. this question), but how could we compute "border" perimeters between two arbitrary regions of the mesh?
Ideally, I'd like to be able to compute pairwise "border lengths", for instance:
BorderLength[R1,R2] = some perimeter length
Thanks!