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
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.
A Mono
object is a monogonal Tiling
, with all vertices having the same gonality, see Archimedean tilings.
From a Mill project
import mill._, scalalib._
object foo extends ScalaModule {
def ivyDeps = Agg(
ivy"vision.id::tessella:0.3.1"
)
}
From an sbt project
libraryDependencies += "vision.id" % "tessella" % "0.3.1"
Each node of the tessellation can be Map
ped 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
- Install Mill
- Open a terminal and
cd
to the repo directory - Use the
mill jvm.test
command to run all tests - Or use the
mill jvm.test.one [testClassName]
command to run a single test class
- Open a terminal and
cd
to the repo directory - Use the
sbt
command to launch sbt - Use the
test
command to run all tests - Or use the
testOnly vision.id.tessella.[testClassName]
command to run a single test class
Uncomment the first test in the outputTest
class and run it.
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
There are only 21 possible combinations of regular p-gons for the full vertex and they use only 14 different p-gons:
- Triangle, 3 sides, alt symbol
▲
- Square, 4 sides, alt symbol
■
- Pentagon, 5 sides, alt symbol
⬟
- Hexagon, 6 sides, alt symbol
⬣
- Eptagon, 7 sides
- Octagon, 8 sides, alt symbol
⯃
- Ennagon, 9 sides
- Decagon, 10 sides
- Dodecagon, 12 sides
- Gon15, 15 sides
- Gon18, 18 sides
- Icosagon, 20 sides
- Gon24, 24 sides
- Gon42, 42 sides
Can be named after the different full vertices it's composed of.
Example: (▲.■.⬣.■)
or (▲⁶; ▲².■.▲.■)