example_graphs
pleat.example_graphs ¶
Example graph constructions: rosettes, tiling growth, and hyperbolic mappings.
SquareDomain ¶
RectangleDomain ¶
get_edge_with ¶
get_edge_with(
graph: HalfEdgeGraph,
func: "callable | None" = None,
on_border: bool = False,
) -> HalfEdge
Return the first half-edge satisfying func, optionally restricted to border edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
HalfEdgeGraph
|
Graph to search. |
required |
func
|
'callable | None'
|
Predicate |
None
|
on_border
|
bool
|
If True, search only border half-edges. |
False
|
Raises:
| Type | Description |
|---|---|
LookupError
|
If no matching half-edge exists. |
Source code in pleat/example_graphs.py
get_vertex_with ¶
get_vertex_with(
graph: HalfEdgeGraph,
func: "callable | None" = None,
on_border: bool = False,
) -> Vertex
Return the first vertex satisfying func, optionally restricted to border vertices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
HalfEdgeGraph
|
Graph to search. |
required |
func
|
'callable | None'
|
Predicate |
None
|
on_border
|
bool
|
If True, search only vertices on the border. |
False
|
Raises:
| Type | Description |
|---|---|
LookupError
|
If no matching vertex exists. |
Source code in pleat/example_graphs.py
rosette ¶
Construct a rosette pattern from n rhombus tiles around a central vertex.
Source code in pleat/example_graphs.py
complete_vertex ¶
Attach tiles around a border vertex until it is fully surrounded.
Source code in pleat/example_graphs.py
add_vertex_ring ¶
Complete all border vertices, prioritizing those with the largest angle sum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
G
|
HalfEdgeGraph
|
The graph to expand. |
required |
domain
|
'Domain | None'
|
If given, only vertices whose |
None
|
Source code in pleat/example_graphs.py
complete_closest_vertices ¶
Complete border vertices closest to the origin.
Source code in pleat/example_graphs.py
from_tiles ¶
from_tiles(
tiles: list[ProtoTile],
rings: int = 2,
vertex_based: bool = True,
base_tile: "int | ProtoTile | HalfEdgeGraph" = -1,
add_positions: bool = True,
) -> HalfEdgeGraph
Grow a tiling from a list of proto-tiles by expanding for the given number of rings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tiles
|
list[ProtoTile]
|
Proto-tiles available for the tiling. |
required |
rings
|
int
|
Number of expansion rings. |
2
|
vertex_based
|
bool
|
If True, expand by completing border vertices; otherwise expand edge by edge. |
True
|
base_tile
|
'int | ProtoTile | HalfEdgeGraph'
|
Starting tile -- index into |
-1
|
add_positions
|
bool
|
If True, attach geometric positions during growth. |
True
|
Returns:
| Type | Description |
|---|---|
HalfEdgeGraph
|
The grown half-edge graph (:class: |
HalfEdgeGraph
|
is True, otherwise :class: |
Source code in pleat/example_graphs.py
fill_domain ¶
fill_domain(
tiles: "list[ProtoTile]",
domain: Domain,
offset: "np.ndarray | None" = None,
max_steps: int = 1000,
) -> EuclideanPositionHEG
Grow a tiling from tiles until domain is filled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tiles
|
'list[ProtoTile]'
|
Proto-tiles available for the tiling (passed to :func: |
required |
domain
|
Domain
|
Bounding region; growth stops when no new tiles fit inside. |
required |
offset
|
'np.ndarray | None'
|
If given, shift every initial vertex position by this 2-vector before growing. Useful for centring an odd-sized tiling within the domain. |
None
|
max_steps
|
int
|
Maximum number of expansion rings to attempt. |
1000
|
Returns:
| Type | Description |
|---|---|
EuclideanPositionHEG
|
The grown :class: |
EuclideanPositionHEG
|
vertex inside |
EuclideanPositionHEG
|
boundary may extend slightly past it (because vertices inside the |
EuclideanPositionHEG
|
domain spawn faces whose other vertices need not be). |
Source code in pleat/example_graphs.py
pgg_2x_tiling ¶
Construct a pgg wallpaper group tiling with the given number of rings.
kised_soccer_ball ¶
Construct a kised soccer ball (icosahedron variant) on the sphere.
Source code in pleat/example_graphs.py
hyperbolic_square_graph ¶
hyperbolic_square_graph(
G: GeometricHEG | None = None,
min_length: float = 0.05,
dual: bool = False,
) -> GeometricHEG
Map a hyperbolic tiling to the Poincare square via the Schwarz-Christoffel mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
G
|
GeometricHEG | None
|
Hyperbolic tiling to map. Defaults to a {7, 3} tiling with one ring. |
None
|
min_length
|
float
|
Minimum target edge length in the square; growth stops once no border vertex falls below this threshold. |
0.05
|
dual
|
bool
|
If True, take the dual graph before mapping. |
False
|
Returns:
| Type | Description |
|---|---|
GeometricHEG
|
A copy of the tiling with positions in the unit square. |
Source code in pleat/example_graphs.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |