polyominoes OpenSCAD code for polyominoes.
Version of Friday 22 December 2023.
Dave Barber's other pages.

§1 Introduction. There is great interest in the polyomino, which according to Wikipedia is "a plane geometric figure formed by joining one or more equal squares edge to edge". The number of squares is the order of the polyomino. Among the areas of study:

When a polyomino is manufactured in plastic, wood, or other material, it is often called a tile. Widely produced as puzzles are sets of a dozen pieces, each a polyomino with five squares, namely a pentomino.

Besides the pentomino with five squares, there are monominoes (one square), mathematical dominoes (two squares), trominoes (three), tetrominoes (four), hexominoes (six), heptominoes (seven), and so forth.

§2 The download. This program provides OpenSCAD code with direct support for producing polyominoes up through order six on a three-dimensional printer. Additionally, the code contains elements that will aid in creating code for orders seven and up. (The present author is willing to program the heptominoes if there is sufficient demand.)

Sources such as Thingiverse already have 3-D printing instructions for pentominoes. How this present offering differs is:

For clarity, each .scad file is named either include_*.scad or print_*.scad to indicate its purpose.

File include_basic.scad contains numerous constants that control the physical appearance of tiles. The user can change these as desired. In particular, the tiles can be made larger and smaller.

Everyone is welcome to download this code, modify it, use it, and redistribute it. OpenSCAD code is plain text which can be modified with an ordinary text editor.

§3 Identifiers. Each tile as printed here has an alphanumeric identifier on top, beginning with an upper-case letter. For the tile of order one, the letter is A; order two B; order three C; and so forth. When the tile has at least three squares, the letter is followed by a one- or two-digit number. There is no meaningful pattern to the numbers, because the present author could not find one.

If two tiles are mirror images of each other, they are given the same number, with one tile arbitrarily chosen to bear the lower-case suffix p, and the other q. The suffixes make the tiles' reflective relationship more obvious. These two letters were chosen because in many sans-serif fonts, their glyphs are approximately mirror images of each other. With the same property are the pairs b and d; b and p; d and q. However, a two-square tile uses an upper-case B, and a four-square uses an upper-case D. So to minimize confusion, b and d were eliminated from consideration, leaving p and q.


Incidentally, the pair n and u are related by 180-degree rotation.

§4 Table of tiles. Due to its length, a full listing of all 89 tiles directly supported in this OpenSCAD code appears on another page. The listing is in schematic form. Here is an excerpt therefrom:


As an example, file tiles_E_07_12/print_E_09p.scad contains only three lines of code:

    include <../include_basic.scad>
    include <include_E_07_12.scad>
    draw_E09p (0, 0, 0);

Here is the pertinent module from tiles_E_07_12/include_E_07_12.scad:

    module draw_E09p (x, y, r) {
        translate ([x * UC_nom_wide, y * UC_nom_wide, 0]) {
            rotate ([0, 0, r * 90]) {
                tile_part_2 (UC_hue_blu,  0,  0, "E");
                tile_part_2 (UC_hue_blu, +2,  0, "0");
                tile_part_2 (UC_hue_blu, +4,  0, "9");
                tile_part_2 (UC_hue_blu, +4, -2, "p");
                tile_part_2 (UC_hue_blu, +6, -2);

                tile_part_1 (UC_hue_blu, +1,  0, true);
                tile_part_1 (UC_hue_blu, +3,  0, true);
                tile_part_1 (UC_hue_blu, +4, -1, false);
                tile_part_1 (UC_hue_blu, +5, -2, true);

This code, when submitted to the OpenSCAD application, will define the tile in a manner suitable for 3-D printing. After the rendering stage, OpenSCAD can export this in the stl format, among others. The .stl file is submitted to a slicer, which will create a G-code file, which is sent to the printer itself.

File print_mix_1.scad shows several tiles separated by minimal gaps, suggesting how they might be tessellated.

File print_mix_2.scad shows several tiles with larger gaps between them. If several tiles are to be 3-D printed at once, these gaps may prevent inadvertent connection of the tiles caused by inaccuracy of the printer.

The present author uses the Ultimaker Cura slicer, and a Creality Ender 5 (non-pro, non-plus) hobbyist-grade printer.

§5 Enumerations.

1monomino 1 0 1
2domino 1 0 1
3tromino 2 0 2
4tetromino 3 2 7
5pentomino 6 6 18
6hexomino 10 25 60
7heptomino20 88 196
8octomino 34 335 704
9nonomino 7012152500
sps + 2p
OEIS sequence A030227 A030228 A000988

There is no simple formula to calculate these numbers.