Thinking inside the circle In as few characters of code as you can, create an algorithm which will pack the least number of rectangles necessary to completely fill a rasterized circle with integer radius r and return the parameters necessary to create each rectangle.



In the above image, the cyan portion is the "idealized" circle. The darkened cells have been selected by a rasterization algorithm. The area to be filled in is within the black line around the cyan circle.

Here's one way to fill that circle:



Here's another:



The fine print:


All units will/must be centimeters.
Rectangles should be in the format [x y width height], where x and y is the position of the upper left corner and width and height are positive numbers for the width and height from that point.

Example: [10 20 40 20][-10 -20 20 40] ...

Rectangles may overlap each other, but their bounds must be within or coincident to the rasterized circle. Rectangles must not extend past those bounds.
The algorithm's results must match what would be expected from the bounds given by the Midpoint Circle Algorithm with parameters x = 0, y = 0, r = radius.
While there might be a minimum number of rectangles needed to fill the circle, finding them might make your code longer than it's worth with respect to the length of the code. (see scoring system below)
It isn't necessary to actually draw anything. Just return the rectangles needed.
Coordinate system should be Cartesian, so not display graphics definition. Eg. (+x, +y) quadrant is north-east of (0, 0), (+x, -y) is south-east, (-x, -y) is south-west, and (-x, +y) is north-west.


To test for correctness, use your chosen rasterization method to draw a circle. Draw the rectangles from your rectangle packing algorithm. Check for gaps inside the circle or pixels outside the circle.

Expected signature of function:

(ℕ radius) → {(ℤ x, ℤ y, ℕ width, ℕ height), ...}

The very complex scoring system:

[code characters]*([rectangles for radius of 10]/10
                   + [rectangles for radius of 100]/100
                   + [rectangles for radius of 1000]/1000)


Lowest score wins. In the event of a tie, winner will be the most popular.

Winner will be selected at midnight GMT, January 16th 2014.
Pre-rule-change answer:

C# / ECMAScript 6 - 12

r=&gt;r


Because overlapping rectangles are allowed, we need at most r rectangles.

Proof:



With a circle of radius 10, it can be filled with 10 rectangles. Each rectangle has been highlighted in a distinct colour.



Older pre-rule-change answer:

C# / ECMAScript 6 - 0.444

r=&gt;1


I believe this meets all the rules as of the time of this writing.

It evaluates to the number of rectangles required to fill a circle, rasterized with this algorithm:

inCircle = max(|x|,|y|) &lt;= radius


This algorithm doesn't yield very high-quality results, but it can still be useful. The popular video game Minecraft uses this algorithm.