Delaunay-Diagramm

by Andreas Kriegl, 2013.02.04

Animation

pts0={{-3,0},{-1,0.2},{1,-0.1},{3,0},{0.4,-1},{-0.6,1.3}}

Clear[Mean2]
Mean2[l_]:={Mean[Flatten[Take[l,All,{1}],2]],Mean[Flatten[Take[l,All,{2}],2]]}
MidPt[l_]:=Block[{p1,p2,n1,n2},p1=l[[1]];p2=l[[2]]; 
n1=1+Norm[p1];
n2=1+Norm[p2];
(p1*n2+p2*n1)/(n1+n2)
]
Manipulate[
G=Graphics[{
PointSize[0.02],
Table[Point[pts0[[i]]],{i,1,Length[pts0]}],
Table[
Line[segment[pts0[[i]],pts0[[j]],Drop[Drop[pts0,{j}],{i}]]],
{i,1,Length[pts0]},{j,i+1,Length[pts0]}
],(* Segments of Voronoi-Diagram *)
Blue,
Table[
If[
Length[segment[pts0[[i]],pts0[[j]],Drop[Drop[pts0,{j}],{i}]]]==0,
{},
Line[{pts0[[i]],pts0[[j]]}]
],
{i,1,Length[pts0]},{j,i+1,Length[pts0]}
]
},
PlotRange->{{-4,4},{-4,4}}
],
{{pts0,{{0,0}}},Locator,LocatorAutoCreate->True},LocalizeVariables->False
]

Use ctrl-alt-left-mouse-button to add or remove points