projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unitary tests for Point class
[linpy.git]
/
linpy
/
geometry.py
diff --git
a/linpy/geometry.py
b/linpy/geometry.py
index
cc19a72
..
0b05493
100644
(file)
--- a/
linpy/geometry.py
+++ b/
linpy/geometry.py
@@
-142,6
+142,14
@@
class Coordinates:
"""
return any(self._coordinates.values())
"""
return any(self._coordinates.values())
+ def __eq__(self, other):
+ """
+ Return True if two coordinate systems are equal.
+ """
+ if isinstance(other, self.__class__):
+ return self._coordinates == other._coordinates
+ return NotImplemented
+
def __hash__(self):
return hash(tuple(self.coordinates()))
def __hash__(self):
return hash(tuple(self.coordinates()))
@@
-206,14
+214,6
@@
class Point(Coordinates, GeometricObject):
return Point(coordinates)
return NotImplemented
return Point(coordinates)
return NotImplemented
- def __eq__(self, other):
- """
- Test whether two points are equal.
- """
- if isinstance(other, Point):
- return self._coordinates == other._coordinates
- return NotImplemented
-
def aspolyhedron(self):
from .polyhedra import Polyhedron
equalities = []
def aspolyhedron(self):
from .polyhedra import Polyhedron
equalities = []
@@
-301,14
+301,6
@@
class Vector(Coordinates):
return Vector(coordinates)
return NotImplemented
return Vector(coordinates)
return NotImplemented
- def __eq__(self, other):
- """
- Test whether two vectors are equal.
- """
- if isinstance(other, Vector):
- return self._coordinates == other._coordinates
- return NotImplemented
-
def angle(self, other):
"""
Retrieve the angle required to rotate the vector into the vector passed
def angle(self, other):
"""
Retrieve the angle required to rotate the vector into the vector passed