diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2019-07-28 10:02:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-28 10:02:28 +0200 |
| commit | d5e873f8c50789b94e24d27a30c72f65ba9c08a3 (patch) | |
| tree | ffa31c0f808f67857cdf7f86ecd2a9da41590a06 /lib/stitches | |
| parent | 833a8a971d8a73fbc42468a89d083e37a0bd6d8d (diff) | |
| parent | e81e819602a3823ec344d412ba2e5213349fb2c4 (diff) | |
Merge pull request #481
show various bugs the door
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/auto_fill.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/stitches/auto_fill.py b/lib/stitches/auto_fill.py index 9d946ae2..8c8cdefd 100644 --- a/lib/stitches/auto_fill.py +++ b/lib/stitches/auto_fill.py @@ -312,6 +312,15 @@ def travel_grating(shape, angle, row_spacing): return shgeo.MultiLineString(segments) +def ensure_multi_line_string(thing): + """Given either a MultiLineString or a single LineString, return a MultiLineString""" + + if isinstance(thing, shgeo.LineString): + return shgeo.MultiLineString([thing]) + else: + return thing + + def build_travel_edges(shape, fill_angle): r"""Given a graph, compute the interior travel edges. @@ -359,10 +368,10 @@ def build_travel_edges(shape, fill_angle): for ls in mls for coord in ls.coords] - diagonal_edges = grating1.symmetric_difference(grating2) + diagonal_edges = ensure_multi_line_string(grating1.symmetric_difference(grating2)) # without this, floating point inaccuracies prevent the intersection points from lining up perfectly. - vertical_edges = snap(grating3.difference(grating1), diagonal_edges, 0.005) + vertical_edges = ensure_multi_line_string(snap(grating3.difference(grating1), diagonal_edges, 0.005)) return endpoints, chain(diagonal_edges, vertical_edges) |
