Delaunay Triangulations

Based on code from Joseph O’Rourke.

Generate a set of 2D points with coords in [-1, 1]:

pts=RandomReal[{-1,1},{20,2}];

Create the Delaunay triangulation as a “mesh region”:

ℛ=DelaunayMesh[pts];

Show the region, and also store the graphics in gDT.

gDT=HighlightMesh[ℛ,{Style[0,Blue,PointSize[Medium]],Style[1,Purple],Style[2,LightCyan]}]

Extract the 2D cells and store in a list Δs. Note the cells are graphics objects Polygon, using indices in pts.

Δs=MeshCells[ℛ,2]

Extract the indexes of the polygons.

Note that we use the part operator twice: [[i]] to get the ith polygon from Δs, and [[1]] to get the arguments from the polygon.

listOfIndices={};
For[i=1,i≤Length[Δs],i++,
AppendTo[listOfIndices,Δs[[i]][[1]]]
];
Print[listOfIndices]

Convert the indexes to 2D coordinates (ordered pairs)

listOfTriPts = {};
For[i=1,i≤Length[Δs],i++,
AppendTo[listOfTriPts,pts[[listOfIndices[[i]]]]]
];
Print[listOfTriPts]

The 2D coordinates can be fed to Circumsphere:

c1=Circumsphere[listOfTriPts[[1]]]

Display both the gDT graphics, and highlight the circumcircle of the 1st cell:

Show[
gDT,
Graphics[{LightGreen,Polygon[listOfTriPts[[1]]],Green,c1}]
,PlotRange->{{-2,2},{-2,2}}
]

Can you produce a drawing that shows circumcircles of all triangles in the Delaunay triangulation?

Can you produce an animation that shows the circumcircles one after another?