summaryrefslogtreecommitdiff
path: root/lib/stitches/tangential_fill_stitch_line_creator.py
diff options
context:
space:
mode:
authorAndreas <v.andreas.1@web.de>2022-03-20 17:15:39 +0100
committerKaalleen <reni@allenka.de>2022-05-04 19:18:33 +0200
commit6916a3371695205ca388daa37e3b9a0cc8d51de6 (patch)
tree199c5851efb7b8149a1eef068382b355fa142c18 /lib/stitches/tangential_fill_stitch_line_creator.py
parent78e0648f99477ab2b8961c1875e8d2fe2381570e (diff)
bug fixing + introduction of min_stitch_distance parameter
Diffstat (limited to 'lib/stitches/tangential_fill_stitch_line_creator.py')
-rw-r--r--lib/stitches/tangential_fill_stitch_line_creator.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/stitches/tangential_fill_stitch_line_creator.py b/lib/stitches/tangential_fill_stitch_line_creator.py
index af14ea0f..4d4377f0 100644
--- a/lib/stitches/tangential_fill_stitch_line_creator.py
+++ b/lib/stitches/tangential_fill_stitch_line_creator.py
@@ -158,7 +158,7 @@ def check_and_prepare_tree_for_valid_spiral(root):
return True
-def offset_poly(poly, offset, join_style, stitch_distance, offset_by_half, strategy, starting_point): # noqa: C901
+def offset_poly(poly, offset, join_style, stitch_distance, min_stitch_distance, offset_by_half, strategy, starting_point): # noqa: C901
"""
Takes a polygon (which can have holes) as input and creates offsetted
versions until the polygon is filled with these smaller offsets.
@@ -173,6 +173,8 @@ def offset_poly(poly, offset, join_style, stitch_distance, offset_by_half, strat
For examples look at
https://shapely.readthedocs.io/en/stable/_images/parallel_offset.png
-stitch_distance maximum allowed stitch distance between two points
+ -min_stitch_distance stitches within a row shall be at least min_stitch_distance apart. Stitches connecting
+ offsetted paths might be shorter.
-offset_by_half: True if the points shall be interlaced
-strategy: According to StitchingStrategy enum class you can select between
different strategies for the connection between parent and childs. In
@@ -315,15 +317,15 @@ def offset_poly(poly, offset, join_style, stitch_distance, offset_by_half, strat
if strategy == StitchingStrategy.CLOSEST_POINT:
(connected_line, connected_line_origin) = tangential_fill_stitch_pattern_creator.connect_raster_tree_nearest_neighbor(
- root, offset, stitch_distance, starting_point, offset_by_half)
+ root, offset, stitch_distance, min_stitch_distance, starting_point, offset_by_half)
elif strategy == StitchingStrategy.INNER_TO_OUTER:
(connected_line, connected_line_origin) = tangential_fill_stitch_pattern_creator.connect_raster_tree_from_inner_to_outer(
- root, offset, stitch_distance, starting_point, offset_by_half)
+ root, offset, stitch_distance, min_stitch_distance, starting_point, offset_by_half)
elif strategy == StitchingStrategy.SPIRAL:
if not check_and_prepare_tree_for_valid_spiral(root):
raise ValueError("Geometry cannot be filled with one spiral!")
(connected_line, connected_line_origin) = tangential_fill_stitch_pattern_creator.connect_raster_tree_spiral(
- root, offset, stitch_distance, starting_point, offset_by_half)
+ root, offset, stitch_distance, min_stitch_distance, starting_point, offset_by_half)
else:
raise ValueError("Invalid stitching stratety!")