scala-tessella / tessella   0.3.0

Apache License 2.0 Website GitHub

Tilings by regular polygons

Scala versions: 3.x
Scala.js versions: 1.x

Tilings by regular polygons

tessella Scala version support Maven Central Scala.js CI Scala Steward badge DOI

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).

sqrHexDodHexoid
SVG output for a Tiling of a [(4.6.12)] pattern

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.

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

Documentation

Scaladoc

The Scaladoc API documentation can be browsed and searched here.

Website

Check the Tessella website for more info.

Deprecation warning

Tessella is replacing the previous project at https://github.com/mcallisto/tessella, now deprecated.