summaryrefslogtreecommitdiff
path: root/lib/graph.py
diff options
context:
space:
mode:
authorlim <lim@stsci.edu>2012-06-18 10:45:51 -0400
committerlim <lim@stsci.edu>2012-06-18 10:45:51 -0400
commitb196c939f8dd233af0811802bf1a125c90063973 (patch)
treefeab5f17a4c35009826612f72f98d290c3cab394 /lib/graph.py
parent15c745cdcec4643721684eefe2ac072ec2c9ed09 (diff)
downloadstsci.sphere-b196c939f8dd233af0811802bf1a125c90063973.tar.gz
lim modified Node.equals as mdroe suggested
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/branches/sphere@17427 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: 860abb81aeca87d1258684fc6c566acab5b294f6
Diffstat (limited to 'lib/graph.py')
-rw-r--r--lib/graph.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/graph.py b/lib/graph.py
index d64074a..c66a873 100644
--- a/lib/graph.py
+++ b/lib/graph.py
@@ -106,12 +106,22 @@ class Graph:
except IndexError:
raise ValueError("Following from disconnected edge")
- def equals(self, other):
+ def equals(self, other, thres=2e-8):
"""
Returns `True` if the location of this and the *other*
`Node` are the same.
+
+ Parameters
+ ----------
+ thres: float
+ If difference is smaller than this, points are equal.
+ The default value of 2e-8 radians is set based on
+ emphirical test cases. Relative threshold based on
+ the actual sizes of polygons is not implemented.
"""
- return np.array_equal(self._point, other._point)
+ #return np.array_equal(self._point, other._point)
+ return great_circle_arc.length(self._point, other._point,
+ degrees=False) < thres
class Edge: