Index
pleat.conway ¶
Conway topological operators for transforming tilings.
Re-exports the operator classes and factory functions from the submodules.
GeometricConwayOperator ¶
Bases: TopologicalConwayOperator
Conway operator that assigns new vertex positions using barycentric coordinate interpolation.
Store the fundamental domain and convert its positions to barycentric coordinates.
After construction, every vertex in self.graph carries barycentric
coordinates relative to the corner triangle (v1, vf, v2). They are
re-projected to Euclidean coordinates per target triangle inside
:meth:generate_graph_and_corners.
Source code in pleat/conway/operators.py
get_tri ¶
Return the triangle (h.dest, face midpoint, h.orig) for half-edge h.
Source code in pleat/conway/operators.py
generate_graph_and_corners ¶
generate_graph_and_corners(
tri: ndarray, h: HalfEdge | None = None
) -> tuple[HalfEdgeGraph, tuple[Vertex, Vertex, Vertex]]
Return a copy of the domain with positions mapped from barycentric to Euclidean coordinates.
Source code in pleat/conway/operators.py
__call__ ¶
__call__(
graph: GeometricHEG,
recompute_lengths_and_angles: bool = True,
**kwargs: object
) -> GeometricHEG
Apply the geometric operator to graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
GeometricHEG
|
Geometric half-edge graph to operate on. |
required |
recompute_lengths_and_angles
|
bool
|
If True, recompute edge lengths and interior angles after substitution. |
True
|
**kwargs
|
object
|
Forwarded to :meth: |
{}
|
Returns:
| Type | Description |
|---|---|
GeometricHEG
|
The transformed graph. |
Source code in pleat/conway/operators.py
get_fundamental_domain_graph_to_render ¶
get_fundamental_domain_graph_to_render(
delete_color: tuple[float, float, float] = (
0.85,
0.15,
0.15,
),
join_color: tuple[float, float, float] = (
0.15,
0.65,
0.2,
),
keep_color: tuple[float, float, float] = (
0.3,
0.3,
0.3,
),
) -> HalfEdgeGraph
Build a copy of the fundamental-domain graph, colouring elements by their role.
Vertices and edges flagged as delete are coloured delete_color
(default: red), and edges become dashed via the existing renderer behaviour;
vertices flagged as join are coloured join_color (default: green); everything else uses keep_color.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delete_color
|
tuple[float, float, float]
|
RGB triple for delete-marked elements. |
(0.85, 0.15, 0.15)
|
join_color
|
tuple[float, float, float]
|
RGB triple for join-marked vertices. |
(0.15, 0.65, 0.2)
|
keep_color
|
tuple[float, float, float]
|
RGB triple for retained elements. |
(0.3, 0.3, 0.3)
|
Returns:
| Type | Description |
|---|---|
HalfEdgeGraph
|
A Euclidean-projected copy of the graph with |
Source code in pleat/conway/operators.py
render ¶
Render the fundamental domain graph with styling from :meth:get_fundamental_domain_graph_to_render.
Source code in pleat/conway/operators.py
show ¶
Render the fundamental domain graph with styling from :meth:get_fundamental_domain_graph_to_render and display it.
TopologicalConwayOperator ¶
Apply a Conway operator to a half-edge graph by substituting a fundamental domain into each face triangle.
The fundamental domain is a small half-edge graph with three marked vertices (v1, vf, v2) corresponding to a vertex, face center, and adjacent vertex of each triangle.
Store the fundamental domain and its three corner vertices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
HalfEdgeGraph
|
Half-edge graph encoding the fundamental domain. |
required |
v1
|
Vertex
|
Corner mapped to |
required |
vf
|
Vertex
|
Corner mapped to the face midpoint of each triangle. |
required |
v2
|
Vertex
|
Corner mapped to |
required |
Source code in pleat/conway/operators.py
show ¶
get_tri ¶
generate_graph_and_corners ¶
generate_graph_and_corners(
tri: "np.ndarray | None", h: HalfEdge | None = None
) -> tuple[HalfEdgeGraph, tuple[Vertex, Vertex, Vertex]]
Return a copy of the fundamental-domain graph and its three corner vertices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tri
|
'np.ndarray | None'
|
Optional reference triangle for geometric subclasses. |
required |
h
|
HalfEdge | None
|
Optional original half-edge; if given, every interior vertex of
the copy gets |
None
|
Returns:
| Type | Description |
|---|---|
tuple[HalfEdgeGraph, tuple[Vertex, Vertex, Vertex]]
|
Tuple |
Source code in pleat/conway/operators.py
__call__ ¶
__call__(
graph: HalfEdgeGraph,
*,
faces: "set[Face] | Callable[[Face], bool] | None" = None,
delete_on_border: bool = True,
delete_inner_border: bool = False,
inplace: bool = False
) -> HalfEdgeGraph
Apply the operator to graph, optionally restricted to faces.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
HalfEdgeGraph
|
Input half-edge graph; left untouched unless |
required |
faces
|
'set[Face] | Callable[[Face], bool] | None'
|
Faces to apply the operator to. Either an explicit set of
faces, or a callable |
None
|
delete_on_border
|
bool
|
If True, delete faces whose original border edge was marked for deletion. |
True
|
delete_inner_border
|
bool
|
If True, also clear the |
False
|
inplace
|
bool
|
If True, mutate |
False
|
Returns:
| Type | Description |
|---|---|
HalfEdgeGraph
|
The transformed graph (the input itself if |
Source code in pleat/conway/operators.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 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 | |
alternating_flagstone_graph ¶
Construct the alternating flagstone operator with parameter t.
Source code in pleat/conway/factories.py
ambo_graph ¶
Construct the Conway ambo (rectification) operator.
Source code in pleat/conway/factories.py
chamfer_graph ¶
Construct the Conway chamfer operator, derived from loft with the v1-v2 edge deleted.
Source code in pleat/conway/factories.py
dual_graph ¶
Construct the Conway dual operator.
Source code in pleat/conway/factories.py
expand_graph ¶
Construct the Conway expand operator with offset parameter t (must be < 1).
Source code in pleat/conway/factories.py
flagstone_pvitelli_graph ¶
Construct the Pvitelli flagstone operator with parameter t (must be < 1).
Source code in pleat/conway/factories.py
goldberg2_graph ¶
Construct the Goldberg-2 subdivision operator.
Source code in pleat/conway/factories.py
gyro_graph ¶
Construct the Conway gyro operator with snub point position g.
Source code in pleat/conway/factories.py
join_graph ¶
Construct the Conway join operator.
Source code in pleat/conway/factories.py
kis_graph ¶
Construct the Conway kis (raising) operator.
Source code in pleat/conway/factories.py
lace_graph ¶
Construct the lace operator with offset t. If join is True, merge the v1-v2 edge.
Source code in pleat/conway/factories.py
loft_graph ¶
Construct the loft operator with edge offset parameter t (must be < 1).
Source code in pleat/conway/factories.py
meta_graph ¶
Construct the Conway meta operator, which includes all edges from dual and kis.
Source code in pleat/conway/factories.py
ortho_graph ¶
Construct the Conway ortho operator, which combines the orignal graph and its dual
Source code in pleat/conway/factories.py
shrink_rotate_graph ¶
Construct the shrink-rotate Conway operator with parameter t.
The operator creates new faces for each original vertex, shrinks the original faces and creates a ring of quadrilateral faces between the twists; the central polygon is later
rotated and scaled around the reciprocal-figure center to produce a
flat-foldable crease pattern (see :mod:pleat.shrink_rotate).
Each twist face is marked with the 'shrink_rotate' attribute so
downstream code can identify it.
Source code in pleat/conway/factories.py
starify_graph ¶
Construct the starify operator with parameter t controlling star point depth.
Source code in pleat/conway/factories.py
truncate_graph ¶
Construct the Conway truncate operator with cut depth t.