Just to clarify, that picture is circles and lines drawn using integer Bressenham, the whole thing drawn and plotted ina fraction of a second.
To calculate holes on a PCD Y= number of steps in a circle, X=number of holes.
Starting at 0,0 then incrementing X by 1 and using integer Bressenham to calculate dY will give the optimum number of steps to the next hole that minimises the accumulated error.
Here's the pseudocode version off Wiklipedia:
plotLine(x0,y0, x1,y1)
dx = x1 - x0
dy = y1 - y0
D = 2*dy - dx
y = y0
for x from x0 to x1
plot(x,y)
if D > 0
y = y + 1
D = D - 2*dx
end if
D = D + 2*dy
It uses only integers and no division so it can be implemented in integer BASIC, machine code, assembly language, C or anything else without the need of any special library or more than the most pedestrian of processors.
This case only plots in the octant where Y increases at the same rate or faster than X, which is what we want (always more steps than holes) so no extra logical tests or direction changes required.
Not that in our special case we want to make the holes at the transitions so we step the dividing head each time we increment the variable Y, and instead of having 'plot X,Y' we replace it with a 'drill hole' command.
Neil
P.S. Duncan's algorithm requires you to calculate how many steps to move to each hole. That is calculated as (number of hole to drill) * (number of steps) / (total number of holes).
This requires division which is much slower, and you need work out (number of hole to drill) * (number of steps) then repeat the division every time to ensure the answer is correctly rounded (using integer artithmetic).
Edited By Neil Wyatt on 01/06/2019 16:44:41