Voronoi diagram: Difference between revisions
Content added Content deleted
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{task}} |
{{task}} |
||
A [[Voronoi Diagram]] is a diagram consisting of a number of sites. Each Voronoi ''s'' also has a Voronoi cell consisting of all points closest to ''s''. |
A [[wp:Voronoi Diagram|Voronoi Diagram]] is a diagram consisting of a number of sites. Each Voronoi ''s'' also has a Voronoi cell consisting of all points closest to ''s''. |
||
=={{header|Python}}== |
=={{header|Python}}== |
||
Line 43: | Line 43: | ||
return voronoi </lang> |
return voronoi </lang> |
||
=== Sample Output: === |
=== Sample Output: === |
||
voronoi = generate_voronoi([(0, 0), (5, 5)]) |
voronoi = generate_voronoi([(0, 0), (5, 5)]) <br> |
||
voronoi[0] : (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (0, 2), (1, 2), (2, 2), (3, 2), (0, 3), (1, 3), (2, 3), (0, 4), (1, 4), (0, 5) // Points closest to (0, 0) |
voronoi[0] : (0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (0, 2), (1, 2), (2, 2), (3, 2), (0, 3), (1, 3), (2, 3), (0, 4), (1, 4), (0, 5) // Points closest to (0, 0) <br> |
||
voronoi[1] : (5, 1), (4, 2), (5, 2), (3, 3), (4, 3), (5, 3), (2, 4), (3, 4), (4, 4), (5, 4), (1, 5), (2, 5), (3, 5), (4, 5), (5, 5) // Points closest to (5, 5) |
voronoi[1] : (5, 1), (4, 2), (5, 2), (3, 3), (4, 3), (5, 3), (2, 4), (3, 4), (4, 4), (5, 4), (1, 5), (2, 5), (3, 5), (4, 5), (5, 5) // Points closest to (5, 5) <br> |