POLYOMINO_CONDENSE
Reflect and Rotate a Polyomino


POLYOMINO_CONDENSE, a C++ library which cleans up a matrix that represents a polyomino by setting all nonzero entries to 1, and removing initial and final rows and columns of zeros.

A polyomino is a shape formed by connecting unit squares edgewise.

A polyomino can be represented by an MxN matrix, whose entries are 1 for squares that are part of the polyomino, and 0 otherwise.

This program is given an MxN matrix that is meant to represent a polyomino. It first replaces all nonzero entries by the value 1. It then "condenses" the matrix, if possible, by removing initial and final rows and columns that are entirely zero.

While this procedure might save a slight amount of space, its purpose is to simplify the task of manipulating polyominos, embedding them in larger shapes, and detecting whether two polyominos describe the same shape.

It is entirely possible, and usual, that the output quantities are simply copies of the input quantities.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

POLYOMINO_CONDENSE is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

PENTOMINOES, a C++ library which provides some utilities for manipulating pentominoes.

POLYOMINO_EMBED, a C++ library which is given matrices defining a region R and a polyomino P, and determines the number of possible embeddings of the polyomino into the region, and the translations necessary to achieve them.

POLYOMINO_ENUMERATE, a C++ library which enumerates chiral, fixed and free polyominoes up to a moderate order.

POLYOMINO_INDEX, a C++ library which is given a matrix defining a polyomino P, and determines a correspondingly shaped matrix which contains an index for each nonzero entry in P.

POLYOMINO_LP_WRITE, a C++ program which writes an LP file describing a (binary) integer programming problem related to the tiling of a region R by copies of polyomino shapes, with possible reflections and rotations.

POLYOMINO_TRANSFORM, a C++ program which applies reflection and rotation transforms to the matrix that represents a polyomino.

Reference:

  1. Solomon Golomb,
    Polyominoes: Puzzles, Patterns, Problems, and Packings,
    Princeton University Press, 1996,
    ISBN: 9780691024448

Source Code:


Last revised on 29 April 2018.