fixed + completed type hints

This commit is contained in:
2024-04-12 23:33:09 +02:00
parent 30339f0ece
commit cce7e96779
8 changed files with 77 additions and 53 deletions

9
vec.py
View File

@@ -5,8 +5,8 @@ from math import sqrt
class Vec:
def __init__(self, x: float = 0, y: float = 0) -> None:
self.x = x
self.y = y
self.x: float = x
self.y: float = y
def __add__(self, v: Vec) -> Vec:
return Vec(self.x+v.x, self.y+v.y)
@@ -25,5 +25,6 @@ class Vec:
def norm(self) -> Vec:
mag = self.mag()
if mag == 0: return Vec()
return self/mag
if mag == 0:
return Vec()
return self / mag