I am representing my 2D space (consider a window), where each pixel is shown as a cell in a 2D array. i.e. a 100x100 window is represented by the array of same dimensions.
For getting a list of all points within a circle you should use:
var radius = 100, r2 = radius * radius;
var circle = [];
for (var dx = -radius; dx <= radius; dx++) {
var h = Math.sqrt(r2 - dx * dx) | 0;
for (var dy = -h; dy <= h; dy++) {
circle.push([dx, dy])
}
}
See http://jsperf.com/circles/2 for profiling against the other solutions here.