summaryrefslogtreecommitdiff
path: root/lib/utils/geometry.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/geometry.py')
-rw-r--r--lib/utils/geometry.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py
index 61b98bcb..d0cb96cf 100644
--- a/lib/utils/geometry.py
+++ b/lib/utils/geometry.py
@@ -65,12 +65,21 @@ class Point:
else:
raise ValueError("cannot multiply Point by %s" % type(other))
+ def __neg__(self):
+ return self * -1
+
def __rmul__(self, other):
if isinstance(other, (int, float)):
return self.__mul__(other)
else:
raise ValueError("cannot multiply Point by %s" % type(other))
+ def __div__(self, other):
+ if isinstance(other, (int, float)):
+ return self * (1.0 / other)
+ else:
+ raise ValueErorr("cannot divide Point by %s" % type(other))
+
def __repr__(self):
return "Point(%s,%s)" % (self.x, self.y)