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).
SVG output for a Tiling of a [(4.6.12)] pattern |
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.
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
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
The Scaladoc API documentation can be browsed and searched here.
Check the Tessella website for more info.
Tessella is replacing the previous project at https://github.com/mcallisto/tessella, now deprecated.