Java Partition Surface into Little Squares
问题 I would like to know if there is any algorithm that does something like this: Given a specific surface it divides it into smaller rectangles of the same size. Something like this example figure: The grey area is the surface, and the red squares is the partition itself. I am thinking if there is a optimized way to do this. A very bad approach would be a for loop in all the pixels and check if there is a rectangle for that specific spot, if not, would create a rectangle, and so on.. Maybe