How the numbers are calculated
BuildShapes uses one calculation for the picture, the block count and the row-by-row steps. This page states the rules so you can check them.
The rules
- The shape sits on a grid of unit blocks, width × height. A circle is the case where both are equal.
- The ellipse is centred on the middle of the grid, with half the width and half the height as its radii.
- A block is placed when its centre is inside or on the ellipse.
- Outline: placed blocks that touch an empty space (or the edge of the grid) on their top, bottom, left or right side.
- Ring of thickness t: the outline, then the outline of what is left, repeated t times. Thickness 1 is the outline; a very thick ring is the filled shape.
All tests use whole-number arithmetic, so there are no rounding surprises at the edges.
A worked example: a 5-block circle
For a circle of width N, cell (x, y) counts as inside when (2x + 1 − N)² + (2y + 1 − N)² ≤ N². Here is that sum for every cell of a 5 × 5 grid, with N² = 25. Cells at or below 25 are placed.
| x = 0 | x = 1 | x = 2 | x = 3 | x = 4 | |
|---|---|---|---|---|---|
| y = 0 | 32 × | 20 | 16 | 20 | 32 × |
| y = 1 | 20 | 8 | 4 | 8 | 20 |
| y = 2 | 16 | 4 | 0 | 4 | 16 |
| y = 3 | 20 | 8 | 4 | 8 | 20 |
| y = 4 | 32 × | 20 | 16 | 20 | 32 × |
Highlighted cells are placed; cells marked × are left empty. The four corners fail, so a filled 5-block circle is 21 blocks. The generator gives 21.
Outline, ring and filled
The same 9-block circle in the three styles:
An outline joins itself diagonally where it steps, so some of its blocks meet only at corners. A ring 2 thick has no corner-only joins for sizes 3 to 50 (checked by automated tests).
Odd and even sizes
An odd size has one centre line (a single centre block for a circle). An even size has two centre lines, so a circle has a 2×2 centre. The shapes are symmetrical left to right and top to bottom, and circles are also symmetrical across the diagonal.
Known figures
These are checked by automated tests, and are produced live by the same code:
- 9-block circle, outline: 24 blocks
- 15-block circle, outline: 40 blocks
- 15-block circle, filled: 177 blocks
- 31-block circle, outline: 84 blocks
Spheres, domes and cylinders
The 3D shapes use their own 3D rules. They are not the circle rule stacked up, except for the cylinder, whose layers really are identical circles.
- A solid sits in a box that is width × height × depth blocks. Layer 1 is the bottom layer. Each layer is a flat grid seen from above, and row 1 is its top edge.
- Sphere: the sphere is centred in a box as wide, tall and deep as the diameter. A block is placed when its centre is inside or on the sphere. The test is done in whole numbers, so there is no rounding at the edge.
- Dome: the upper half of that sphere. For an odd diameter the dome starts at the sphere's middle layer. For an even diameter it keeps the upper half of the layers. Height is the diameter divided by two, rounded up.
- Cylinder: the circle rule above, repeated for every layer up to the height you choose.
- Hollow walls: a wall of thickness t keeps every placed block that is within t steps of empty space, where one step moves one block up, down or sideways. Thickness 1 keeps the blocks that touch empty space on a face, which gives a shell with no see-through gaps. A hollow dome is cut from a hollow sphere, so it is open underneath.
- Open tube and closed cylinder: an open tube has walls only. A closed cylinder uses the same wall rule in all three directions, so its floor and roof are as thick as its walls.
Checked by automated tests: sizes against an independent floating-point calculation, wall rules against a literal peel-the-outside check, left-right and front-back symmetry, layer counts, block totals, and sizes at the edges. Produced live by the same code:
- 15-block filled sphere: 1791 blocks, 15 layers
- 15-block hollow sphere: 530 blocks, 15 layers
- 16-block hollow sphere: 632 blocks, 16 layers
- 21-block hollow dome: 569 blocks, 11 layers
- 20-block filled dome: 2112 blocks, 10 layers
- 15 × 10 cylinder, filled: 1770 blocks
- 15 × 10 cylinder, hollow, open tube: 400 blocks
- 15 × 10 cylinder, hollow, closed: 674 blocks
A dome of diameter 21 is 11 blocks tall and one of diameter 20 is 10.
Tori
A torus is a ring: a tube swept around a circle. Here it always lies flat, so the hole runs straight down.
- The box is the outer diameter N wide and deep, and the tube diameter T high. T runs from 1 to half of N (rounded down), so the hole, N − 2T blocks across, is never negative.
- The ring's centre line is a circle of radius (N − T) / 2 about the middle of the box. The tube has radius T / 2.
- A block is placed when its centre is inside or on the tube: the distance from the centre line, taken in the vertical plane through the block, is at most T / 2. The test is done in whole numbers, with no square roots rounded.
- Hollow torus: the same wall rule as the sphere, with the wall thickness you set. A wall as thick as the tube is the filled torus.
- With a tube of 1, the one layer is a ring of blocks within half a block of the centre line. It has the same or more blocks than the circle outline (the thinnest 8-connected line), because the band is a full block wide on the diagonals.
Produced live by the same code:
- Outer 21, tube 7: 1696 blocks filled, 724 hollow (wall 1), hole 7 across
- Outer 15, tube 5: 668 blocks filled, 368 hollow (wall 1), hole 5 across
- Outer 31, tube 9: 4516 blocks filled, 1564 hollow (wall 1), hole 13 across
Arches
The arch is a round (semicircular) front profile, repeated back for the depth you choose.
- Settings: outer width W (3 or more), arch thickness t (from 1 up to (W − 1) / 2, rounded down, so the opening stays at least 1 wide), leg height L (0 or more) and depth D. Height is L plus half of W, rounded up.
- The first L rows are straight legs: the left t columns and the right t columns.
- Above the legs the curve is the upper half of a circle of diameter W, cut like a dome: for an odd W the widest row is the first row of the curve; for an even W the widest of two equal rows is.
- The opening is the circle of diameter W − 2t on the same centre. A block of the curve is placed when its centre is inside or on the outer circle and not inside or on the inner one. Whole-number arithmetic throughout.
- Every depth position has the same profile.
For example, an arch 9 wide with thickness 2 and 3 leg rows is 8 blocks tall. Its front profile, top row first (the Front view of the arch generator shows this, and each row is one layer):
An arch 13 wide, thickness 2, 4 leg rows and depth 3 is 156 blocks and 11 tall.
Pyramids
The pyramid is a stack of centred squares on a square base.
- Settings: base size N, step s (how many blocks each level is set in on every side) and level height r (layers per level).
- Level i, counting from 0 at the bottom, covers the squares inset by i × s on every side. A level exists while it is at least 1 block wide, so there are (N − 1) / (2s), rounded down, plus 1 levels. Height is levels × r.
- With s = 1 and r = 1, an odd base ends in one block and an even base in a 2 × 2 top.
- Hollow: the sphere's wall rule, with the wall thickness you set. With the underside open, the base is treated as continuing downward while the walls are worked out, so the base layer is a ring and there is no floor. With a floor, the base layer is solid.
- Base 5, step 1, level height 1: 3 layers, 35 blocks filled
- Base 15, step 1, level height 1: 8 layers, 680 blocks filled
- Base 10, step 2, level height 1: 3 layers, 140 blocks filled
- Base 5, step 1, level height 3: 9 layers, 105 blocks filled
- Base 15, hollow, wall 1: 225 blocks open underneath, 394 with a floor
Limits and differences from other tools
Sizes from 1 to 256 are supported, for circles and ovals and for the diameter and height of spheres, domes and cylinders, and for the outer diameter of tori (2 or more), the width and depth of arches (3 or more for the width), and the base of pyramids. Other generators may draw the same size slightly differently, because there is more than one reasonable way to round a circle onto blocks; this page documents the rule BuildShapes uses.
- Ovals are axis-aligned: no tilted ellipses.
- Domes are true half-spheres: no height control.
- Cylinders have a round cross-section only.
- Tori lie flat (no standing rings), and the tube is always round.
- Arches are round (semicircular) only: no pointed, elliptical or flat-topped arches.
- Pyramids have a square base and stepped sides.
- Counts are for the shape as drawn. Doors, windows and decoration change what you place.
- For the 3D shapes, no third-party tool's figures were used as a source or comparison.
Putting it to use
The building guides apply these rules step by step:
- How to build a circle: Pick a size, find the centre, build one quarter, mirror it, count the blocks.
- Odd vs even circles: One centre block or a 2×2 centre: what changes and which to choose.
- How to build an oval: Width and height are independent, and so is each one’s centre.
- How to build a sphere: Layers from the bottom up, why half of them repeat, and what a hollow shell saves.
- How to build a dome: Height, headroom and the flat top of a thin dome.
- How to build a cylinder: One circle repeated per layer, with or without a floor and roof.
- How to build a torus: Outer diameter, tube and hole: how three numbers set every layer.
- How to build an arch: Width, legs and thickness set the front profile. Depth just repeats it.
- How to build a pyramid: Base, step and level height: how many levels, how tall and how many blocks.