Generating Equidistant Points on Unit Disk

Recently I needed an algorithm to generate equidistant points inside the unit disk with some of them placed on the boundary (circle). To my surprise, quick search didn’t reveal any simple method for this. Below is obvious solution & code, hopefully it will save some time for others.

MATLAB code:

function [x, y, Nb, Np] = eqdisk(Nr)
%EQDISK Generates equidistant points inside the unit disk.
%   Nr  [in]  - number of radial circles
%   x,y [out] - coordinates of generated points
%   Np  [out] - total number of generated points
%   Nb  [out] - points on boundary (on r = 1 circle)

dR = 1/Nr;

x(1) = 0;
y(1) = 0;

k = 1;
for r = dR:dR:1
    n = round(pi/asin(1/(2*k)));
    theta = linspace(0, 2*pi, n+1)'; 
    x = [x; r.*cos(theta(1:n))];
    y = [y; r.*sin(theta(1:n))];
    k = k+1;

Nb = n;
Np = size(x,1);

Algorithm is based on the idea of placing the points on concentric circles with (near-) equal arc length between them. Here is some examples:




Note the “equilibrium” case, when we have the same number of points on boundary and inside the disk, Nr=3 (19/19).

1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 4.92)

One Comment

  1. Posted August 11, 2018 at 8:40 am | #

    Tammes and Thomson problems can be considered as an extension for non-Platonic cases. For instance, see Math Overflow: Distributing points evenly on a sphere . Sadly, general solutions to these problems are not trivial.

Post a Comment

Your email is never published nor shared.

Use native LaTeX syntax to include formulas: $ ... $, \[ ... \], etc. Do not forget to preview comment before posting.

Also you may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Subscribe without commenting