Implement methods Polyhedron.__contains__(), Domain.__contains__()
[linpy.git] / pypol / domains.py
index 3ab7d44..255c995 100644 (file)
@@ -312,6 +312,12 @@ class Domain:
             points.append(Point(coordinates))
         return points
 
             points.append(Point(coordinates))
         return points
 
+    def __contains__(self, point):
+        for polyhedron in self.polyhedra:
+            if point in polyhedron:
+                return True
+        return False
+
     def subs(self, symbol, expression=None):
         polyhedra = [polyhedron.subs(symbol, expression)
             for polyhedron in self.polyhedra]
     def subs(self, symbol, expression=None):
         polyhedra = [polyhedron.subs(symbol, expression)
             for polyhedron in self.polyhedra]