summaryrefslogtreecommitdiff
path: root/lib/stitches/meander_fill.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2023-04-02 00:14:57 -0400
committerLex Neva <github.com@lexneva.name>2023-04-02 00:14:57 -0400
commitf57d61b6e68ac9d0047361cc6fd140064b22545d (patch)
treee18ecdc9384e363c0ae1cedd37a45a2d6e5275e4 /lib/stitches/meander_fill.py
parentacdb911145972012cf8055c9accd31a235214ca7 (diff)
meander fixes
Diffstat (limited to 'lib/stitches/meander_fill.py')
-rw-r--r--lib/stitches/meander_fill.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/stitches/meander_fill.py b/lib/stitches/meander_fill.py
index 0a59da72..29ec6270 100644
--- a/lib/stitches/meander_fill.py
+++ b/lib/stitches/meander_fill.py
@@ -2,7 +2,7 @@ from itertools import combinations
import networkx as nx
from inkex import errormsg
-from shapely.geometry import MultiPoint, Point
+from shapely.geometry import LineString, MultiPoint, Point
from shapely.ops import nearest_points
from .. import tiles
@@ -126,10 +126,16 @@ def generate_meander_path(graph, start, end, rng):
check_stop_flag()
edge1, edge2 = poprandom(edge_pairs, rng)
- edges_to_consider.extend(replace_edge_pair(meander_path, edge1, edge2, graph, graph_nodes))
- break
+ new_edges = replace_edge_pair(meander_path, edge1, edge2, graph, graph_nodes)
+ if new_edges:
+ edges_to_consider.extend(new_edges)
+ break
+
+ debug.log_graph(graph, "remaining graph", "#FF0000")
+ points = path_to_points(meander_path)
+ debug.log_line_string(LineString(points), "meander path", "#00FF00")
- return path_to_points(meander_path)
+ return points
def replace_edge(path, edge, graph, graph_nodes):