fixed + completed type hints
This commit is contained in:
9
vec.py
9
vec.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user