brute force, just test every bin. You'll want to adjust something, but this is the idea.
New Window( "test",
gb = Graph Box(
Frame Size( 800, 800 ),
radius = 43;
xstep = 5;// bin stride across
xsize = 3;// bin width
ystep = 4;// bin stride down
ysize = 2;// bin height
xmin = 0;
xmax = 100;
xcenter = Mean( xmin, xmax );
ymin = 0;
ymax = 100;
ycenter = Mean( ymin, ymax );
// the bins are identified by their upper left corner
isOutside = Function( {x, y}, // is this point out of the circle?
Sqrt( (x - xcenter) ^ 2 + (y - ycenter) ^ 2 ) > radius
);
isAllOutside = Function( {x, y}, // are all 4 points of this bin out of the circle?
isOutside( x, y ) & isOutside( x + xsize, y ) & isOutside( x, y + ysize ) & isOutside( x + xsize, y + ysize )
);
Circle( {xcenter, ycenter}, radius );
For( x = xcenter - xsize / 2 - xstep * Ceiling( radius / xstep ), x <= xcenter + xsize / 2 + xstep * Ceiling( radius / xstep ), x += xstep,
For( y = ycenter - ysize / 2 - ystep * Ceiling( radius / ystep ), y <= ycenter + ysize / 2 + ystep * Ceiling( radius / ystep ),
y += ystep,
// is this bin outside, and the right,below siblings not outside?
If( isAllOutside( x, y ) & !isAllOutside( x + xstep, y ) & !isAllOutside( x, y + ystep ),
Rect( x, y, x + xsize, y + ysize, fill = 1 ),
Rect( x, y, x + xsize, y + ysize, fill = 0 )
)
)
);
)
);
gb << setyaxis( {Min( 100 ), Max( 0 )} );
The for-loops look complicated just to center the bins on the circle. I don't know what the real rule is.
I'm a bit unclear on the rule that will make exactly one selection.
Craige