import operator
from abc import ABC, abstractmethod
-from collections import OrderedDict
+from collections import OrderedDict, Mapping
from .linexprs import Symbol
This class represents points in space.
"""
- def __new__(cls, coordinates=None):
- if isinstance(coordinates, dict):
+ def __new__(cls, coordinates):
+ if isinstance(coordinates, Mapping):
coordinates = coordinates.items()
self = object().__new__(cls)
self._coordinates = OrderedDict()
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):
"""