fold
pleat.io.fold ¶
FOLD (v1.2) crease-pattern import/export.
FOLD spec: https://github.com/edemaine/fold/blob/main/doc/spec.md
Scope: Euclidean 2D crease patterns. See docs/superpowers/specs for the design.
Opening a pattern in Origami Simulator lives in :mod:pleat.origami_simulator.
graph_to_fold ¶
Serialise a Euclidean crease-pattern graph to a FOLD v1.2 dict.
Undirected edges are the rev-pairs of G.halfedges. Each edge's
assignment comes from :data:CREASE_ASSIGNMENT (M/V), or "B" when either
side is a border half-edge, or "U" otherwise. Faces are G.faces (the
outer region is not a Face in pleat), each emitted as its CCW vertex loop.
Raises:
| Type | Description |
|---|---|
ValueError
|
if G does not have real 2D vertex positions -- FOLD cannot represent the hyperbolic (complex Poincaré-disk) or spherical (3D) coordinates pleat uses for curved tilings. |
Source code in pleat/io/fold.py
fold_to_graph ¶
Reconstruct a Euclidean half-edge graph from a FOLD dict.
Requires faces_vertices (needs oriented faces to rebuild the DCEL).
Interior edges are twinned across their two faces; boundary edges get a
border twin (face=None) linked into the outer cycle. vertices_coords
restores positions and edges_assignment restores M/V creases.
Source code in pleat/io/fold.py
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 | |
save_fold ¶
Write G to a .fold JSON file (appends .fold if missing).