From d42890f2142a3fa524679e113693deae646bcd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Sun, 8 Sep 2024 12:01:04 -0300 Subject: [PATCH] Fix bug when trying to calculate the angle from vectors too close to each other. --- src/bonsai/bonsai/tool/cad.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/tool/cad.py b/src/bonsai/bonsai/tool/cad.py index 44b4b58d92..4914a4ff8c 100644 --- a/src/bonsai/bonsai/tool/cad.py +++ b/src/bonsai/bonsai/tool/cad.py @@ -100,7 +100,10 @@ class Cad: axis = d1.cross(d2).normalized() # Calculate the unsigned angle between the "d1" and "d2" vectors - a = d1.angle(d2) + try: + a = d1.angle(d2) + except: + a = 0 # Determine the sign of the angle based on the provided axis # If new_angle, determine the direction of the rotation