From be0aec17cf4726918cd365f8dc471ee172cd76f5 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sun, 20 Mar 2022 21:23:54 +0100 Subject: [PATCH] FingerJoints: Add "barb" style --- boxes/edges.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/boxes/edges.py b/boxes/edges.py index f682500..27994b0 100644 --- a/boxes/edges.py +++ b/boxes/edges.py @@ -684,7 +684,7 @@ Values: """ absolute_params = { - "style" : ("rectangular", "springs"), + "style" : ("rectangular", "springs", "barbs"), "surroundingspaces": 2.0, "angle" : 90.0, } @@ -790,7 +790,17 @@ class FingerJointEdge(BaseEdge, FingerJointBase): 0.1 * h, 90, 0.9*h, -180, 0.9*h, 90, f - 0.6*h, 90, 0.9*h, -180, 0.9*h, 90, 0.1*h, - (90 * p, 0.2 *h), 0.8*h, -90 * p) + (90 * p, 0.2 *h), 0.8*h, -90 * p) + elif positive and self.settings.style == "barbs": + t = self.settings.thickness + n = int((h-0.1*t) // (0.3*t)) + a = math.degrees(math.atan(0.5)) + l = 5**0.5 + poly = [h - n*0.3*t] + \ + ([-45, 0.1*2**0.5*t, 45+a, l*0.1*t, -a, 0] * n) + self.polyline( + 0, -90, *poly, 90, f, 90, *reversed(poly), -90 + ) else: self.polyline(0, -90 * p, h, 90 * p, f, 90 * p, h, -90 * p)