summaryrefslogtreecommitdiff
path: root/lib/elements
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-03 06:52:03 +0200
committerGitHub <noreply@github.com>2024-06-03 06:52:03 +0200
commit7f9ae2ca1eb5b89b0705363911bab242486642db (patch)
tree8aa8d8f48efa707176a77a5135f5744303958941 /lib/elements
parent4cf85797bc18c2f0b78a401c112c4cc183ca881f (diff)
Avoid FloatingPointError (fill) (#2959)
Diffstat (limited to 'lib/elements')
-rw-r--r--lib/elements/fill_stitch.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py
index 6bf52d95..7d96fd14 100644
--- a/lib/elements/fill_stitch.py
+++ b/lib/elements/fill_stitch.py
@@ -9,6 +9,7 @@ import re
import numpy as np
from inkex import LinearGradient, Transform
from shapely import geometry as shgeo
+from shapely import set_precision
from shapely.errors import GEOSException
from shapely.ops import nearest_points
from shapely.validation import explain_validity, make_valid
@@ -726,7 +727,8 @@ class FillStitch(EmbroideryElement):
@property
@cache
def shape(self):
- shape = self._get_clipped_path()
+ # avoid FloatingPointError while keeping a decent precision necessary for clamp path
+ shape = set_precision(self._get_clipped_path(), 0.0000000001)
if shape.is_valid:
return ensure_multi_polygon(shape, 3)