summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/stitches/running_stitch.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py
index 47e4fa35..6c6a4d1d 100644
--- a/lib/stitches/running_stitch.py
+++ b/lib/stitches/running_stitch.py
@@ -53,16 +53,20 @@ def split_segment_random_phase(a, b, length: float, length_sigma: float, random_
return [line.interpolate(x, normalized=False) for x in splits]
-def split_segment_stagger_phase(a, b, segment_length: float, num_staggers: int, this_segment_num: int) -> typing.List[shgeo.Point]:
+def split_segment_stagger_phase(a, b, segment_length: float, num_staggers: int, this_segment_num: int, min=0, max=None) \
+ -> typing.List[shgeo.Point]:
line = shgeo.LineString([a, b])
distance = line.length
stagger_phase = (this_segment_num / num_staggers) % 1
stagger_offset = stagger_phase * segment_length
+ if max is None:
+ max = distance
splits = []
progress = stagger_offset
while progress < distance:
- splits.append(progress)
+ if progress > min and progress < max:
+ splits.append(progress)
progress += segment_length
return [line.interpolate(x, normalized=False) for x in splits]