Tilings (tessellations) by regular polygons

Build Status Maven Central Codacy Badge Codecov badge

Tilings by regular polygons

Tessella is a Scala library that helps working with finite unit-regular-polygon tessellations of a flat surface, a classical theme in the wider field of tessellations (or tilings). See a mathematical definition of tiling for a more accurate notion of the chosen constraints.


Finite set of the (▲.■.⬣.■) Archimedean (1-uniform) tiling

Tessellation as graph

Each tessellation is internally described as an undirected graph, where:

  • each node of the graph is a vertex of a polygon and it is represented by a unique Int
  • each edge of the graph is a side of a polygon

The graph describing the tessellation is a Tiling object and can be created through algorithms. Many of them, exploiting linear symmetries or growth strategies, are already available from the creation subpackage.

An undirected graph is not necessarily a valid Tiling, see graph validation.

Graphs are seamless Scala collections thanks to the excellent Graph for Scala library by Peter Empen.

Stronger constraints

A Mono object is a monogonal Tiling, with all vertices having the same gonality, see Archimedean tilings.

How to


From a Mill project

import mill._, scalalib._

object foo extends ScalaModule {
  def ivyDeps = Agg(

From an sbt project

libraryDependencies += "vision.id" % "tessella" % "0.3.1"

Draw a tessellation

Each node of the tessellation can be Mapped to a cartesian point with the Tiling.toNodesMap method. The tessellation can then be rendered as a layered SVG image with the Draw(…) method of the SVG trait.

The lowest node is always at coordinates (0.0, 0.0) and the second lowest at (1.0, 0.0).

On top of the edge layer, the following optional additions are possible:

  • node labels


  • perimeter polygon


  • filled polygons coloured according to number of sides


  • full vertices coloured according to type of adjacent polygons (gonality)

    (▲⁶; (⬣³)²; (▲².⬣²)²)


The library can be built with


  1. Install Mill
  2. Open a terminal and cd to the repo directory
  3. Use the mill jvm.test command to run all tests
  4. Or use the mill jvm.test.one [testClassName] command to run a single test class


  1. Open a terminal and cd to the repo directory
  2. Use the sbt command to launch sbt
  3. Use the test command to run all tests
  4. Or use the testOnly vision.id.tessella.[testClassName] command to run a single test class

Redraw the images in the /docs folder

Uncomment the first test in the outputTest class and run it.

Draw several examples of algorithmic tessellations

Uncomment the second test in the outputTest class, run it and view them ordered in the temporary out/jvm/test/myAlgos folder.


For the library methods a given vertex is described by the ordered adjacent regular p-gons joined at the vertex.

Example: (▲.■), alternative form (3.4)

Note: description can be shortened if consecutive identical elements, where (⬣.⬣.▲) becomes (⬣².▲), alternative form (6*2.3)

A vertex is full when the adjacent regular p-gons join to exactly complete a full circle.

Examples: (▲.■.⬣.■) and (■.⬣.12)

In a finite tessellation:

  • all vertices on the perimeter are NOT full
  • all other vertices are full

14 p-gons

There are only 21 possible combinations of regular p-gons for the full vertex and they use only 14 different p-gons:

  1. Triangle, 3 sides, alt symbol
  2. Square, 4 sides, alt symbol
  3. Pentagon, 5 sides, alt symbol
  4. Hexagon, 6 sides, alt symbol
  5. Eptagon, 7 sides
  6. Octagon, 8 sides, alt symbol
  7. Ennagon, 9 sides
  8. Decagon, 10 sides
  9. Dodecagon, 12 sides
  10. Gon15, 15 sides
  11. Gon18, 18 sides
  12. Icosagon, 20 sides
  13. Gon24, 24 sides
  14. Gon42, 42 sides

Infinite tiling

Can be named after the different full vertices it's composed of.

Example: (▲.■.⬣.■) or (▲⁶; ▲².■.▲.■)