When I create a Voronoi diagram from a set of generator points and then recover the cells through MeshPrimitives, the order of the cells does not match the order of the supplied generator points. What's an efficient way to sort the cells to match the order in which the generator points were supplied?
An example:
voronoiCells = MeshPrimitives[VoronoiMesh[{{0, 0}, {1, 1}, {2, 2}}], 2];
RegionMember[voronoiCells[[1]], {0, 0}]
RegionMember[voronoiCells[[2]], {1, 1}]
RegionMember[voronoiCells[[3]], {2, 2}]
(*True, False, False*)
In this example, the position of the second and third cells are swapped (relative to the generator points). I'm not sure how the cells are ordered by default.