Tessella

Tilings by regular polygons

Tessella is a Scala 3 library, compatible with Scala.js, that helps to deal with finite unit-regular-polygon tessellations of a flat surface, a classical theme in the wider field of tessellations (or tilings).

Note

See a mathematical definition of tiling for a more accurate notion of the chosen constraints.

sqrHexDodHexoid
Finite set of a [(4.6.12)] pattern

Setup

Add the following dependency to your build.sbt file:

libraryDependencies += "io.github.scala-tessella" %% "tessella" % "0.3.0" // Use %%% instead of %% if you're using ScalaJS

Getting started

First, start with the following import:

import io.github.scala_tessella.tessella.Tiling.*

Then you can write something like:

Tiling.fromPolygon(5) // Tiling(1--2, 1--5, 2--3, 3--4, 4--5)
Tiling.fromPolygon(7).graphNodes // List(1, 2, 3, 4, 5, 6, 7)
Tiling.fromPolygon(4).area // 1.0

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.

Note

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

Conversion

A Tiling can be rendered as an SVG vector image, see Tiling to SVG.

Being an undirected graph, it can also be converted to DOT language, see Tiling to DOT.

Programmatic creation

A Tiling can be created through algorithms. Many of them, exploiting linear symmetries or growth strategies, are already available from the creation subpackage.

See Regular and SemiRegular.

Deprecation

Warning

This library is replacing the previous project at github.com/mcallisto/tessella, now deprecated.

Read here about the improvements.

The source code for this page can be found here.