From b196c939f8dd233af0811802bf1a125c90063973 Mon Sep 17 00:00:00 2001 From: lim Date: Mon, 18 Jun 2012 14:45:51 +0000 Subject: 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 --- lib/graph.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/graph.py') 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: -- cgit