diff --git a/model/distance.py b/model/distance.py index 8010d173..e4dcd4c1 100644 --- a/model/distance.py +++ b/model/distance.py @@ -223,6 +223,7 @@ def matrix_basis(self): x_axis = Vector((1, 0)) alignment = self.align align = self.is_align() + angle = 0 e1, e2 = self.entity1, self.entity2 # e1 e2 @@ -273,7 +274,10 @@ def matrix_basis(self): if alignment == "HORIZONTAL" else Vector((0.0, 1.0)) ) - angle = v_rotation.angle_signed(x_axis) + + if v_rotation.length != 0: + angle = v_rotation.angle_signed(x_axis) + mat_rot = Matrix.Rotation(angle, 2, "Z") v_translation = (p2 + p1) / 2 @@ -291,8 +295,7 @@ def matrix_basis(self): ) if v_rotation.length != 0: angle = v_rotation.angle_signed(x_axis) - else: - angle = 0 + mat_rot = Matrix.Rotation(angle, 2, "Z") v_translation = (p2 + p1) / 2 else: