From 3a441427da441e1c13c349453ae642de9fdc7ab2 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Sat, 13 May 2023 12:24:48 +0200 Subject: ripple constant end position --- lib/stitches/ripple_stitch.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/stitches/ripple_stitch.py') diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py index 4e1c563e..dc85445a 100644 --- a/lib/stitches/ripple_stitch.py +++ b/lib/stitches/ripple_stitch.py @@ -103,6 +103,11 @@ def _get_satin_line_count(stroke, pairs): if shortest_line_len == 0 or length < shortest_line_len: shortest_line_len = length num_lines = ceil(shortest_line_len / stroke.min_line_dist) + # we want the line count to be constantly even or odd (even if the design is resized + # so the stitch plan can be carefully planed connecting the end point to the following object + if stroke.line_count % 2 != num_lines % 2: + num_lines -= 1 + # for flat join styles we need to add an other line if stroke.join_style == 1: num_lines += 1 return num_lines -- cgit v1.2.3 From 111fd8f0ef7bc8e62322c38a7a7467c453f85331 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Sat, 13 May 2023 21:11:27 +0200 Subject: * move all gradient methods to extension * add underlay to single color elements to compensate density --- lib/stitches/ripple_stitch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/stitches/ripple_stitch.py') diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py index dc85445a..52d91c2d 100644 --- a/lib/stitches/ripple_stitch.py +++ b/lib/stitches/ripple_stitch.py @@ -103,8 +103,9 @@ def _get_satin_line_count(stroke, pairs): if shortest_line_len == 0 or length < shortest_line_len: shortest_line_len = length num_lines = ceil(shortest_line_len / stroke.min_line_dist) - # we want the line count to be constantly even or odd (even if the design is resized - # so the stitch plan can be carefully planed connecting the end point to the following object + # We want the line count always to be either even or odd - depending on the line count value. + # So that the end point stays the same even if the design is resized. This is necessary to enable + # the user to carefully plan the output and and connect the end point to the following object if stroke.line_count % 2 != num_lines % 2: num_lines -= 1 # for flat join styles we need to add an other line -- cgit v1.2.3 From 6931d4868d05128b4bb148fe1714dedc808591b4 Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Sun, 14 May 2023 09:11:33 +0200 Subject: ripple: line count --- lib/stitches/ripple_stitch.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/stitches/ripple_stitch.py') diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py index 52d91c2d..80800b04 100644 --- a/lib/stitches/ripple_stitch.py +++ b/lib/stitches/ripple_stitch.py @@ -103,15 +103,7 @@ def _get_satin_line_count(stroke, pairs): if shortest_line_len == 0 or length < shortest_line_len: shortest_line_len = length num_lines = ceil(shortest_line_len / stroke.min_line_dist) - # We want the line count always to be either even or odd - depending on the line count value. - # So that the end point stays the same even if the design is resized. This is necessary to enable - # the user to carefully plan the output and and connect the end point to the following object - if stroke.line_count % 2 != num_lines % 2: - num_lines -= 1 - # for flat join styles we need to add an other line - if stroke.join_style == 1: - num_lines += 1 - return num_lines + return _line_count_adjust(stroke, num_lines) def _get_target_line_count(stroke, target, outline): @@ -123,9 +115,19 @@ def _get_guided_line_count(stroke, guide_line): num_lines = stroke.line_count else: num_lines = ceil(guide_line.length / stroke.min_line_dist) + return _line_count_adjust(stroke, num_lines) + + +def _line_count_adjust(stroke, num_lines): + if stroke.min_line_dist and stroke.line_count % 2 != num_lines % 2: + # We want the line count always to be either even or odd - depending on the line count value. + # So that the end point stays the same even if the design is resized. This is necessary to enable + # the user to carefully plan the output and and connect the end point to the following object + num_lines -= 1 if stroke.is_closed or stroke.join_style == 1: + # for flat join styles we need to add an other line num_lines += 1 - return num_lines + return max(1, num_lines) def _get_helper_lines(stroke): -- cgit v1.2.3 From 6c46eb2d866f97a1009a20a4446dbc3bdfcbb98a Mon Sep 17 00:00:00 2001 From: Kaalleen Date: Sun, 14 May 2023 09:32:23 +0200 Subject: ripple: ensure min line count --- lib/stitches/ripple_stitch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/stitches/ripple_stitch.py') diff --git a/lib/stitches/ripple_stitch.py b/lib/stitches/ripple_stitch.py index 80800b04..40a522eb 100644 --- a/lib/stitches/ripple_stitch.py +++ b/lib/stitches/ripple_stitch.py @@ -124,10 +124,12 @@ def _line_count_adjust(stroke, num_lines): # So that the end point stays the same even if the design is resized. This is necessary to enable # the user to carefully plan the output and and connect the end point to the following object num_lines -= 1 + # ensure minimum line count + num_lines = max(1, num_lines) if stroke.is_closed or stroke.join_style == 1: # for flat join styles we need to add an other line num_lines += 1 - return max(1, num_lines) + return num_lines def _get_helper_lines(stroke): -- cgit v1.2.3