Skip to content

Function: partition() ​

ts
function partition(
   outlines, 
   label, 
   scale
): Map<number, Shape[]>;

Split the plane into regions by a labeling function: each point gets a label (a number; negative for "nothing"), and every region of equal label is returned as shapes. The labels may only change across the given outlines (closed loops; pass an open polyline's segments as two-point "loops"), which are cut where they meet like overlay's.

Parameters ​

ParameterType
outlinesPolygon[]
label(p) => number
scalenumber

Returns ​

Map<number, Shape[]>

Hat tiling and isohedral tilings after Craig S. Kaplan's hatviz and Tactile (BSD 3-Clause).