diff --git a/utils.py b/utils.py index e7a3e73..d1afa7c 100644 --- a/utils.py +++ b/utils.py @@ -59,6 +59,15 @@ class Vec: return Vec(x, y, self.z - other.z) + def times(self, factor: float) -> 'Vec': + x = self.x * factor + y = self.y * factor + + if self.z == None: + return Vec(x, y) + + return Vec(x, y, self.z * factor) + def div(self, factor: float) -> 'Vec': x = self.x / factor y = self.y / factor