Wolfram Research

Function Repository Resource:

DiskPoints

Source Notebook

Get uniformly distributed points on a disk

Contributed by: Sander Huisman  |  SHuisman

ResourceFunction["DiskPoints"][n]

gives the positions of n uniformly distributed points on a unit disk.

Details and Options

The points are distributed using Vogel's phyllotaxis method.

Examples

Basic Examples (2) 

500 uniformly distributed points on a unit disk:

In[1]:=
Graphics[Point[ResourceFunction["DiskPoints"][500]]]
Out[1]=

Compare this with the boundaries of a unit disk:

In[2]:=
Graphics[{Circle[], Point[ResourceFunction["DiskPoints"][500]]}]
Out[2]=

Applications (1) 

Use DiskPoints to make a uniform mesh:

In[3]:=
DelaunayMesh[ResourceFunction["DiskPoints"][500]]
Out[3]=

Neat Examples (3) 

Connect each point to its nearest neighbor:

In[4]:=
pts = ResourceFunction["DiskPoints"][1200];
nf = Nearest[pts];
pairs = {#, nf[#, {2, \[Infinity]}][[-1]]} & /@ pts;
Graphics[{Circle[], Line@pairs, Point[pts]}]
Out[5]=

Highlight the non-uniformity in the area determined using Voronoi analysis:

In[6]:=
pts = ResourceFunction["DiskPoints"][1000];
pols = MeshPrimitives[VoronoiMesh[pts], 2];
val = Median[Area /@ pols] 1.4;
pols = Select[pols, Area/*LessThan[val]];
areas = Rescale[Area /@ pols];
Graphics[{ColorData["Rainbow"] /@ areas, pols} // Transpose]
Out[7]=

Find the minimum spanning tree for 2000 points, and show the connectedness:

In[8]:=
FindSpanningTree[ResourceFunction["DiskPoints"][2000], VertexCoordinates -> Automatic]
Out[8]=

Resource History

Related Resources

License Information