summaryrefslogtreecommitdiff
path: root/lib/stitches/running_stitch.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stitches/running_stitch.py')
-rw-r--r--lib/stitches/running_stitch.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stitches/running_stitch.py b/lib/stitches/running_stitch.py
index f3ca8a29..c1c2d99c 100644
--- a/lib/stitches/running_stitch.py
+++ b/lib/stitches/running_stitch.py
@@ -227,9 +227,9 @@ def path_to_curves(points: typing.List[Point], min_len: float):
aabb = (a * a) * (b * b)
abab = (a * b) * abs(a * b)
- # Test if the turn angle from vectors a to b is more than 45 degrees
- # Uses the property of inner products that abab = ± aabb * cos(angle(a,b))**2
- if aabb > 0 and abab < 0.5 * aabb:
+ # Test if the turn angle from vectors a to b is more than 45 degrees.
+ # Optimized version of checking if cos(angle(a,b)) <= sqrt(0.5) and is defined
+ if aabb > 0 and abab <= 0.5 * aabb:
if seg_len >= min_len:
curves.append(points[last: i + 1])
last = i