diff --git a/compiler/base/vector.py b/compiler/base/vector.py index 8bf09f7d..6688462d 100644 --- a/compiler/base/vector.py +++ b/compiler/base/vector.py @@ -28,6 +28,7 @@ class vector(): else: self.x = float(x) self.y = float(y) + self._hash = hash((self.x,self.y)) def __str__(self): """ override print function output """ @@ -97,7 +98,7 @@ class vector(): Note: This assumes that you DON'T CHANGE THE VECTOR or it will break things. """ - return hash((self.x,self.y)) + return self._hash def snap_to_grid(self): self.x = self.snap_offset_to_grid(self.x) diff --git a/compiler/router/vector3d.py b/compiler/router/vector3d.py index 0d183021..066f843f 100644 --- a/compiler/router/vector3d.py +++ b/compiler/router/vector3d.py @@ -27,7 +27,7 @@ class vector3d(): self.x = x self.y = y self.z = z - + self._hash = hash((self.x,self.y,self.z)) def __str__(self): """ override print function output """ @@ -96,7 +96,7 @@ class vector3d(): Note: This assumes that you DON'T CHANGE THE VECTOR or it will break things. """ - return hash((self.x,self.y,self.z)) + return self._hash def __rsub__(self, other):