TilingLattice

io.github.scala_tessella.dcel.TilingLattice
object TilingLattice

Largest parallelogon contained in a tiling (ADR-0015) and the translation-lattice detection it builds on.

Public API (extensions on TilingDCEL): largestContainedParallelogon (ordered corner vertices, the headline query) and translationLattice (the reduced primitive basis). The block view (cell dimensions

  • area) behind the corners is kept package-private until a consumer needs it.

Detects the primitive translation lattice {v, w} of a finite periodic patch from its interior structure. Vertices are typed by an orientation-aware signature (the sorted directions to their neighbours), then the lattice is read off the single most populous signature class — one translation orbit, whose pairwise differences are exactly the period lattice. This is robust to a handful of welded foreign faces (they form minority classes and stay invisible) and naturally excludes cross-orientation vectors (e.g. between 6.6.6's two [6,6,6] sublattices). A candidate is kept only if it has enough overlap with the patch, ruling out large vectors with little genuine support.

Candidates are validated structurally over the whole interior (signature-preserving on the overlap, a few welded-face defects tolerated), and the result is Lagrange–Gauss reduced to a canonical primitive basis.

Residual assumption: a vertex is typed only by its first neighbour ring, so two distinct translation orbits that happen to share a first-ring signature would be conflated. Regular tilings (3⁶, 4⁴, 6⁶, 4.8.8, …) do not exhibit this; a deeper (second-ring) signature would generalise it.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Extensions

Extensions

extension (tiling: TilingDCEL)
def largestContainedParallelogon(minOverlapFraction: Double = ...): Option[List[Vertex]]

The largest parallelogon contained in the patch (ADR-0015), as its ordered corner vertices (4 or 6) — the corners where the parallelogon's sides meet, and the limit tessellation the patch tends to.

The largest parallelogon contained in the patch (ADR-0015), as its ordered corner vertices (4 or 6) — the corners where the parallelogon's sides meet, and the limit tessellation the patch tends to.

Two paths:

  1. Whole-boundary fast path — if the patch's own boundary is already a parallelogon, the whole patch is the answer (nothing larger fits), so its boundary corners are returned directly, no lattice needed. This also handles single units (a lone square, a regular hexagon, a joined-hexagon badge).
  2. Otherwise, the lattice search: detect the translation lattice, take the maximal block of whole cells, walk its union boundary, and read off the turning corners via parallelogonIndices.

Corners are genuine tiling vertices, ordered, rotated to start at the lowest corner for determinism.

Attributes

Returns

the corner vertices, or None if the patch is neither a parallelogon nor contains one

def translationLattice(minOverlapFraction: Double = ...): Option[(BigPoint, BigPoint)]

Detects the primitive translation lattice, if the patch is periodic.

Detects the primitive translation lattice, if the patch is periodic.

Attributes

Returns

(v, w) the Lagrange–Gauss reduced primitive basis (sign-canonicalised), or None if no lattice is found