summaryrefslogtreecommitdiff
path: root/stsci/sphere/polygon.py
diff options
context:
space:
mode:
authormdroe <mdroe@stsci.edu>2014-06-04 15:37:32 -0400
committermdroe <mdroe@stsci.edu>2014-06-04 15:37:32 -0400
commit5f6068fb585a25d9d07800844a0fa23f4b6347c9 (patch)
tree0d6a0ca20b9d716a03e046ef3345cf5170959699 /stsci/sphere/polygon.py
parent2f4c246d0ff88b736f69679ddcab3c2d8257e281 (diff)
downloadstsci.sphere-5f6068fb585a25d9d07800844a0fa23f4b6347c9.tar.gz
Fix some numerical problems that prevented some very short arcs that were colocated with the edges of a polygon from being recognized as inside the polygon.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@32335 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: df6e3d7c90b358c56d4f84df17b19a742e405337
Diffstat (limited to 'stsci/sphere/polygon.py')
-rw-r--r--stsci/sphere/polygon.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/stsci/sphere/polygon.py b/stsci/sphere/polygon.py
index 06f6b80..2d67ff2 100644
--- a/stsci/sphere/polygon.py
+++ b/stsci/sphere/polygon.py
@@ -498,16 +498,20 @@ class SphericalPolygon(object):
Determines if this `SphericalPolygon` intersects or contains
the given arc.
"""
- return self.contains_point(great_circle_arc.midpoint(a, b))
+ P = self._points
- if self.contains_point(a) and self.contains_point(b):
+ if self.contains_arc(a, b):
return True
- P = self._points
intersects = great_circle_arc.intersects(P[:-1], P[1:], a, b)
- if np.any(intersects):
- return True
- return False
+ return np.any(intersects)
+
+ def contains_arc(self, a, b):
+ """
+ Returns `True` if the polygon fully encloses the arc given by a
+ and b.
+ """
+ return self.contains_point(a) and self.contains_point(b)
def area(self):
r"""