diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-07-01 17:01:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-01 17:01:53 +0200 |
| commit | 37bf83d8db69d91d9f104511dceb8227ba8108eb (patch) | |
| tree | 907e9d15f32689a6f71c7b3968c55e305a9ba7ef /lib/stitches | |
| parent | 251a3b84075b0d8742369186609ef13ad2ec1e90 (diff) | |
remove small lines from tartan strokes (#3035)
Diffstat (limited to 'lib/stitches')
| -rw-r--r-- | lib/stitches/tartan_fill.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/stitches/tartan_fill.py b/lib/stitches/tartan_fill.py index acac1ed1..ad3e0370 100644 --- a/lib/stitches/tartan_fill.py +++ b/lib/stitches/tartan_fill.py @@ -713,6 +713,8 @@ def _get_fill_stitch_groups( starting_point = ensure_multi_line_string(shape.boundary).geoms[0].coords[1] ending_point = ensure_multi_line_string(shape.boundary).geoms[0].coords[1] segments = [list(line.coords) for line in lines if len(line.coords) > 1] + if len(segments) == 0: + continue stitch_group = _segments_to_stitch_group(fill, shape, segments, i, color, starting_point, ending_point) if stitch_group is not None: stitch_groups.append(stitch_group) @@ -737,9 +739,13 @@ def _get_run_stitch_groups( :param ending_point: the ending point :returns: a list with StitchGroup objects """ + stitch_groups: List[StitchGroup] = [] for color, lines in color_lines.items(): - segments = [list(line.coords) for line in lines if len(line.coords) > 1] + # get segments and ignore lines smaller than 0.5 mm + segments = [list(line.coords) for line in lines if line.length > 0.5 * PIXELS_PER_MM] + if len(segments) == 0: + continue stitch_group = _segments_to_stitch_group(fill, shape, segments, None, color, starting_point, ending_point, True) if stitch_group is not None: stitch_groups.append(stitch_group) |
