Voronoi Diagram

Author

Eric W. Weisstein
March 10, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/ComputationalGeometry/VoronoiDiagram.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/VoronoiDiagram.html.

©2011 Wolfram Research, Inc. except for portions noted otherwise

Plane

SeedRandom[1];
pts=RandomReal[{},{20,3}];

ComputationalGeometry

<<ComputationalGeometry`

VoronoiDiagram[Most/@pts]

g1=Show[{
DiagramPlot[Most/@pts,LabelPoints->False]/._Point:>{},
Graphics[{PointSize[.02],Point[Most/@pts]}]
},ImageSize->300,PlotRange->{{0,1},{0,1}},Frame->True,PlotRangeClipping->True]

ListDensityPlot

g2=ListDensityPlot[pts,ColorFunction->"Rainbow",InterpolationOrder->0,ImageSize->300,Epilog->{PointSize[.02],Point[Most/@pts]},PlotRange->{{0,1},{0,1}}]

DensityPlot

nf=Nearest[Most/@pts]

DensityPlot[First[nf[{x,y}]],{x,0,1},{y,0,1},PlotPoints->100,ColorFunction->"Rainbow",Epilog->{PointSize[.02],Point[Most/@pts]},ImageSize->300,PlotRange->{{0,1},{0,1}}]

ListPlot3D

g3=Show[{
ListPlot3D[pts,InterpolationOrder->0,Mesh->None,Filling->Bottom,ColorFunction->"Rainbow",PlotRange->{{0,1},{0,1},Automatic}],
Graphics3D[{PointSize[.02],Point[pts]}]},
ImageSize->Medium ]

Collect Them together

GraphicsGrid[{{g1,g2,g3}},ImageSize->500]

GraphicsGrid[{{g1,g2,g3}},ImageSize->600]

Sphere

From Ulises, 3/10/2011

Graphics`Mesh`MeshInit[];

pts=Table[(pt=RandomReal[{-1,1},{3}];pt/Norm[pt]),{i,300}];

trimesh=ConvexHullMesh[pts];
vormesh=DualMesh[trimesh];

GraphicsRow[{GeometryPlot3D[{trimesh},Mesh->All,PlotStyle->Red,Boxed->False],GeometryPlot3D[{vormesh},Mesh->All,PlotStyle->Yellow,Boxed->False]},Spacings->-100]