summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-11-27 08:37:59 +0100
committerGitHub <noreply@github.com>2022-11-27 08:37:59 +0100
commite9278c55c34b72bb0beccf0d9b8bfe300aacac70 (patch)
tree0bd9728003f1cf8b03ba2ed610fafdcd217267fd /lib/extensions
parent9c0b64560cadc246b3555951ddb1e21960662553 (diff)
This and that (#1727)
* dont fail on satin with fill * fill stitch error message * convert to satin mac issue * auto_satin: add rung for two node old style satins * avoid divide by zero in intersect_region_with_grating * fix for incorrect stagger in guided fill * better rail sectioning algorithm * fix #1780 * fix #1816 Co-authored-by: Lex Neva
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/convert_to_satin.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/extensions/convert_to_satin.py b/lib/extensions/convert_to_satin.py
index 93850789..5512a095 100644
--- a/lib/extensions/convert_to_satin.py
+++ b/lib/extensions/convert_to_satin.py
@@ -129,11 +129,16 @@ class ConvertToSatin(InkstitchExtension):
if Point(*path[0]).distance(Point(*path[-1])) < 1:
raise SelfIntersectionError()
+ # Shapely is supposed to return right sided offsets in reversed direction, which it does, except for macOS.
+ # To avoid direction checking, we are going to rely on left side offsets only.
+ # Therefore we need to reverse the original path.
+ reversed_path = shgeo.LineString(reversed(path))
path = shgeo.LineString(path)
+ distance = stroke_width / 2.0
try:
- left_rail = path.parallel_offset(stroke_width / 2.0, 'left', **style_args)
- right_rail = path.parallel_offset(stroke_width / 2.0, 'right', **style_args)
+ left_rail = path.parallel_offset(distance, 'left', **style_args)
+ right_rail = reversed_path.parallel_offset(distance, 'left', **style_args)
except ValueError:
# TODO: fix this error automatically
# Error reference: https://github.com/inkstitch/inkstitch/issues/964
@@ -149,7 +154,6 @@ class ConvertToSatin(InkstitchExtension):
# https://shapely.readthedocs.io/en/latest/manual.html#object.parallel_offset
raise SelfIntersectionError()
- # for whatever reason, shapely returns a right-side offset's coordinates in reverse
left_rail = list(left_rail.coords)
right_rail = list(reversed(right_rail.coords))