POLYOMINO_EMBED
Embed a Polyomino in a Region


POLYOMINO_EMBED, a MATLAB 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.

A region R is a subset of an MRxNR grid of squares.

A polyomino P is a subset of an MPxNP grid of squares.

Both objects are represented by binary matrices, with the property that there are no initial or final zero rows or columns.

For this computation, we regard P as a "fixed" polyomino; in other words, no reflections or rotations will be allowed.

An "embedding" of P into R is an offset (MI,NJ) such that

  P(I,J) = R(I+MI,J+NJ) 
  for 1 <=  I <=    MP, 1 <=  J <=    NP, and 
  for 0 <= MI <= MR-MP, 0 <= MJ <= NR-NP.
We can detect an embedding simply by taking what amounts to a kind of dot product of P with a corresponding subregion of R.

Licensing:

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

Source Code:

Examples and Tests:


Last revised on 01 May 2018.