How this calculator works
The page lays a square grid of the chosen width over the circle and measures the distance from each block centre to the middle of the grid. A cell is kept when its distance is no more than the radius, and, for a hollow circle, when it is also farther from the centre than the inner radius. The radius is half the diameter, so an odd diameter has a single centre block and an even diameter has a 2 by 2 centre. The result is the same kind of grid as the midpoint circle algorithm used in computer graphics, adapted to whole blocks.
Formula
radius = diameter / 2. centre coordinate = (diameter - 1) / 2. For each cell at column c and row r, distance = sqrt((c - centre)^2 + (r - centre)^2). Keep the cell when distance is at most the radius and greater than the radius minus the thickness. The total is the number of kept cells. A thickness at least as large as the radius removes the inner test and produces a filled disc.
Worked example
A diameter of 5 with a thickness of 1 is a 5 by 5 grid with rows .###., #...#, #...#, #...# and .###., which is 12 blocks. The same diameter filled to the middle is 21 blocks. A diameter of 3 with thickness 1 is the eight-block outline of a 3 by 3 square, with the centre empty; filling it gives 9 blocks.
Advertisement
Frequently asked questions
Why is a small circle square?
At three blocks across there is no room to round the corners, so the closest shape is the 3 by 3 square, or its eight-block outline when you ask for a thickness of one. Roundness improves as the diameter grows. A diameter of 5 already has its corners cut, and larger circles approach a smooth curve.
What does thickness mean here?
Thickness is the width of the wall in blocks, measured inward from the outer edge. One block gives an outline, two gives a thicker wall, and a value as large as the radius gives a filled disc. The inner radius is the outer radius minus the thickness.
Why are odd and even diameters different?
An odd width has a single block at the centre, so the circle is symmetric around that block. An even width has a 2 by 2 centre, and the blocks sit in four symmetric quadrants. Both are valid; the grid simply has no single middle cell for an even number.
Can I use this pattern to build a sphere or a dome?
A sphere is a stack of circles whose radius shrinks with height: at height h above the centre, the radius is sqrt(R^2 - h^2). This page gives the circle for one layer. Generate several diameters and stack them, or use a sphere tool, if you need the whole volume.
How do I copy the pattern into the game?
Build from the pattern table directly, starting at one corner and working row by row. A hash mark is a block and a dot is empty space. Keep the orientation fixed, because a circle is symmetric only if you mirror the pattern correctly; the row table makes that easy to check.