From 7f9ae2ca1eb5b89b0705363911bab242486642db Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 3 Jun 2024 06:52:03 +0200 Subject: Avoid FloatingPointError (fill) (#2959) --- lib/elements/fill_stitch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/elements/fill_stitch.py') 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) -- cgit v1.2.3