Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute shortest tours visiting all lattice points within each Voronoi cell in a region
ResourceFunction["VoronoiCellTours"][pts, reg] computes shortest tours starting from each point in pts within each Voronoi cell of the Voronoi diagram from pts within the region reg. |
Compute shortest tours starting at three random starting points within a rectangle:
In[1]:= | ![]() |
Out[5]= | ![]() |
Compute the shortest tour from a single point within a rectangle:
In[6]:= | ![]() |
Out[9]= | ![]() |
Compute shortest tours within Voronoi cells from five random points within a random convex polygon:
In[10]:= | ![]() |
Out[14]= | ![]() |
Use the resource function LloydAlgorithm with VoronoiCellTours for shortest tours within Voronoi cells of similar areas:
In[15]:= | ![]() |
Out[20]= | ![]() |
If a point does not lie within the region, a shortest tour is not computed within the point's Voronoi cell:
In[21]:= | ![]() |
Out[24]= | ![]() |
VoronoiCellTours is not able to correctly compute shortest tours for some concave regions:
In[25]:= | ![]() |
Out[29]= | ![]() |
Compute shortest tours within Voronoi cells from eight random points within a convex polygon:
In[30]:= | ![]() |
Out[34]= | ![]() |
Compute shortest tours within Voronoi cells from 10 random points within a large disk region:
In[35]:= | ![]() |
Out[39]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License