Plot domain added
[linpy.git] / pypol / geometry.py
index ce055a4..1dc50eb 100644 (file)
@@ -71,6 +71,9 @@ class Coordinates:
 
     __getitem__ = coordinate
 
 
     __getitem__ = coordinate
 
+    def values(self):
+        yield from self._coordinates.values()
+
     def __bool__(self):
         return any(self._coordinates.values())
 
     def __bool__(self):
         return any(self._coordinates.values())
 
@@ -106,6 +109,9 @@ class Point(Coordinates, GeometricObject):
     def isorigin(self):
         return not bool(self)
 
     def isorigin(self):
         return not bool(self)
 
+    def __hash__(self):
+        return super().__hash__()
+
     def __add__(self, other):
         if not isinstance(other, Vector):
             return NotImplemented
     def __add__(self, other):
         if not isinstance(other, Vector):
             return NotImplemented
@@ -145,14 +151,18 @@ class Vector(Coordinates):
             initial = Point(initial)
         if terminal is None:
             coordinates = initial._coordinates
             initial = Point(initial)
         if terminal is None:
             coordinates = initial._coordinates
-        elif not isinstance(terminal, Point):
-            terminal = Point(terminal)
+        else:
+            if not isinstance(terminal, Point):
+                terminal = Point(terminal)
             coordinates = terminal._map2(initial, operator.sub)
         return super().__new__(cls, coordinates)
 
     def isnull(self):
         return not bool(self)
 
             coordinates = terminal._map2(initial, operator.sub)
         return super().__new__(cls, coordinates)
 
     def isnull(self):
         return not bool(self)
 
+    def __hash__(self):
+        return super().__hash__()
+
     def __add__(self, other):
         if isinstance(other, (Point, Vector)):
             coordinates = self._map2(other, operator.add)
     def __add__(self, other):
         if isinstance(other, (Point, Vector)):
             coordinates = self._map2(other, operator.add)