k4st
public text v1 · immutableGiven a circle of radius R centred at (X, Y)
public void circleNegate(int centerx, int centery, int radius)
{
for(int y=centery-radius, y<=radius, y++)
// right so far?
for x in [X-R, X+R]:
for y in [Y-R, Y+R]:
if distance([x,y], [X,Y]) <= R:
negate pixel
end
end