summaryrefslogtreecommitdiff
path: root/lib/stitches/tangential_fill_stitch_pattern_creator.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2022-05-02 15:00:52 -0400
committerKaalleen <reni@allenka.de>2022-05-04 19:18:33 +0200
commit76ab3197317f258ede1bd98195535f33b856b3fd (patch)
tree9e0b61107d6f37ef81a279088797fa6d4578b235 /lib/stitches/tangential_fill_stitch_pattern_creator.py
parent60fb7d0a9efa43d3b58867927ecede6cfdc5ab21 (diff)
add avoid_self_Crossing option
Diffstat (limited to 'lib/stitches/tangential_fill_stitch_pattern_creator.py')
-rw-r--r--lib/stitches/tangential_fill_stitch_pattern_creator.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/stitches/tangential_fill_stitch_pattern_creator.py b/lib/stitches/tangential_fill_stitch_pattern_creator.py
index 20f7a651..553241f8 100644
--- a/lib/stitches/tangential_fill_stitch_pattern_creator.py
+++ b/lib/stitches/tangential_fill_stitch_pattern_creator.py
@@ -110,7 +110,7 @@ def create_nearest_points_list(
@debug.time
def connect_raster_tree_from_inner_to_outer(tree, node, offset, stitch_distance, min_stitch_distance, starting_point,
- offset_by_half): # noqa: C901
+ offset_by_half, avoid_self_crossing, forward=True):
"""
Takes the offset curves organized as a tree, connects and samples them.
Strategy: A connection from parent to child is made as fast as possible to
@@ -137,6 +137,9 @@ def connect_raster_tree_from_inner_to_outer(tree, node, offset, stitch_distance,
current_node = tree.nodes[node]
current_ring = current_node.val
+ if not forward and avoid_self_crossing:
+ current_ring = reverse_line_string(current_ring)
+
# reorder the coordinates of this ring so that it starts with
# a point nearest the starting_point
start_distance = current_ring.project(starting_point)
@@ -157,7 +160,8 @@ def connect_raster_tree_from_inner_to_outer(tree, node, offset, stitch_distance,
if not nearest_points_list:
# We have no children, so we're at the center of a spiral. Reversing
# the ring gives a nicer visual appearance.
- current_ring = reverse_line_string(current_ring)
+ # current_ring = reverse_line_string(current_ring)
+ pass
else:
# This is a recursive algorithm. We'll stitch along this ring, pausing
# to jump to each child ring in turn and sew it before continuing on
@@ -184,6 +188,8 @@ def connect_raster_tree_from_inner_to_outer(tree, node, offset, stitch_distance,
min_stitch_distance,
child_connection.nearest_point_child,
offset_by_half,
+ avoid_self_crossing,
+ not forward
)
result_coords.extend(child_path.coords)