summaryrefslogtreecommitdiff
path: root/stsci/sphere/polygon.py
diff options
context:
space:
mode:
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"""