diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-11-12 19:03:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-12 19:03:49 +0100 |
| commit | 7c99a138d12bcd5f9f4cdbfd3ff7c2b15ec890e4 (patch) | |
| tree | 25e28e384633dc749d24caef831dfdb876f12165 /lib/utils | |
| parent | 3c7d9d4a5aef223e0698ce3d2b26fb92067099a6 (diff) | |
unit: prevent zerodivision error for zero length segments (#3268)
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/geometry.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py index e5296ef0..568f883d 100644 --- a/lib/utils/geometry.py +++ b/lib/utils/geometry.py @@ -303,6 +303,8 @@ class Point: def unit(self): length = self.length() + if length == 0: + return self.__class__(0, 0) return self.__class__(self.x / length, self.y / length) def angle(self): |
