parser
pleat.gjh.parser ¶
Parse a GomJau-Hogg code into a finite half-edge graph.
Pipeline:
- :func:
polygon_placementparses the first stage (e.g."6-3-3") into a small seed graph by gluing regular polygons together. - :func:
apply_transforminterprets each later stage (e.g."m30","r(h2)","r(c3)") as one or more affine transforms. - :func:
compile_gjh_graphapplies the transforms iteratively, expanding the graph until no new tiles fit within the requested bounding box.
seed_polygon ¶
Construct an isolated regular n-gon graph (oriented for use as a seed).
Source code in pleat/gjh/parser.py
polygon_placement ¶
Parse the first stage of a GJH code (polygons separated by - and ,) into a graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
First stage of a GJH code, e.g. |
required |
Returns:
| Type | Description |
|---|---|
EuclideanPositionHEG
|
A small Euclidean half-edge graph containing all placed polygons. |
Source code in pleat/gjh/parser.py
apply_transform ¶
Parse a stage-2+ transform code ("m30", "r(h2)", "r(c3)", "m", "r") into matrices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
G
|
EuclideanPositionHEG
|
The current graph; used to look up face centers, vertices, and edges
referenced by |
required |
code
|
str
|
One transform stage. Possible forms:
|
required |
Returns:
| Type | Description |
|---|---|
list[ndarray]
|
A list of one or more 3x3 affine matrices (homogeneous 2D transforms). |
Source code in pleat/gjh/parser.py
compile_gjh_graph ¶
Compile a full GJH code into a finite tiled :class:EuclideanPositionHEG.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
A full GJH code, e.g. |
required |
bbox_size
|
float
|
Side length of the square bounding box (centred at the origin) within which to expand the tiling. Larger values produce more tiles. |
20.0
|
Returns:
| Type | Description |
|---|---|
EuclideanPositionHEG
|
The expanded tiling as a Euclidean half-edge graph. |