geometry.py

changeset 38
66c9591b733d
parent 31
02e7e1d73ebb
child 62
f0a6bf48b05e
--- a/geometry.py	Fri May 24 15:32:10 2019 +0300
+++ b/geometry.py	Fri May 24 17:37:10 2019 +0200
@@ -67,24 +67,19 @@
     def __matmul__(self, transformation_matrix):
         return transform(self, transformation_matrix)
     def __eq__(self, other):
-        return self.is_close(other, threshold = 1e-10)
+        return self.is_close(other, threshold = 1.0e-10)
     def __ne__(self, other):
         return not self.__eq__(other)
     def __lt__(self, other):
         return self.coordinates < other.coordinates
     def __hash__(self):
         return hash(self.coordinates)
-    def is_close(self, other, *, threshold):
-        return all(
-            abs(a - b) < threshold
-            for a, b in zip(self.coordinates, other.coordinates)
-        )
-
-class VertexOp:
-    def __init__(self, callable):
-        self.callable = callable
-    def __rmul__(self, coordinate):
-        return self.callable(coordinate)
+    def is_close(self, other, *, threshold = 1.0e-05):
+        return self.distance_to(other) < threshold
+        #return all(
+        #    abs(a - b) < threshold
+        #    for a, b in zip(self.coordinates, other.coordinates)
+        #)
 
 class LineSegment:
     def __init__(self, v1, v2):

mercurial