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.
seems correct. you can make it slightly faster by finding minY and then doing DoSomething from -rangeY to +rangeY for the current X.
for(dx=0;dx