X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/blobdiff_plain/b3c0d23e54fe4362097a2b77c34f7bc5b492e2a0..aa599e7cf61fd5c6c5453ba13c3fbc2d178144de:/pypol/coordinates.py diff --git a/pypol/coordinates.py b/pypol/coordinates.py index 78e8d4a..f76b30a 100644 --- a/pypol/coordinates.py +++ b/pypol/coordinates.py @@ -74,7 +74,7 @@ class Point(Coordinates): This class represents points in space. """ - def __new__(cls, coordinates=None): + def __new__(cls, coordinates): if isinstance(coordinates, Mapping): coordinates = coordinates.items() self = object().__new__(cls) @@ -112,6 +112,13 @@ class Point(Coordinates): return isinstance(other, Point) and \ self._coordinates == other._coordinates + def aspolyhedron(self): + from .polyhedra import Polyhedron + equalities = [] + for symbol, coordinate in self.coordinates(): + equalities.append(symbol - coordinate) + return Polyhedron(equalities) + class Vector(Coordinates): """