unit: prevent zerodivision error for zero length segments (#3268)

pull/3287/head
Kaalleen 2024-11-12 19:03:49 +01:00 zatwierdzone przez GitHub
rodzic 3c7d9d4a5a
commit 7c99a138d1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -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):