add multiplication

This commit is contained in:
Mylloon 2023-03-31 04:08:18 +02:00
parent 5d11939769
commit cfaef4f2c2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

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