summaryrefslogtreecommitdiff
path: root/stsci/sphere/great_circle_arc.py
diff options
context:
space:
mode:
Diffstat (limited to 'stsci/sphere/great_circle_arc.py')
-rw-r--r--stsci/sphere/great_circle_arc.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/stsci/sphere/great_circle_arc.py b/stsci/sphere/great_circle_arc.py
index 59260c9..0b47d89 100644
--- a/stsci/sphere/great_circle_arc.py
+++ b/stsci/sphere/great_circle_arc.py
@@ -59,8 +59,9 @@ else:
from numpy.core.umath_tests import inner1d
-__all__ = ['angle', 'intersection', 'intersects', 'length', 'midpoint',
- 'interpolate']
+___all__ = ['angle', 'intersection', 'intersects', 'intersects_point',
+ 'length', 'midpoint', 'interpolate']
+
def _fast_cross(a, b):
@@ -139,13 +140,13 @@ def intersection(A, B, C, D):
.. math::
- s_1 = ((A × B) × A) · T
+ s_1 = ((A × B) × A) \cdot T
- s_2 = (B × (A × B)) · T
+ s_2 = (B × (A × B)) \cdot T
- s_3 = ((C × D) × C) · T
+ s_3 = ((C × D) × C) \cdot T
- s_4 = (D × (C × D)) · T
+ s_4 = (D × (C × D)) \cdot T
For :math:`s_n`, if all positive :math:`T` is returned as-is. If
all negative, :math:`T` is multiplied by :math:`-1`. Otherwise
@@ -160,6 +161,9 @@ def intersection(A, B, C, D):
http://www.mathworks.com/matlabcentral/newsreader/view_thread/276271
"""
+ if HAS_C_UFUNCS:
+ return math_util.intersection(A, B, C, D)
+
A = np.asanyarray(A)
B = np.asanyarray(B)
C = np.asanyarray(C)
@@ -199,10 +203,6 @@ def intersection(A, B, C, D):
return np.where(equals, np.nan, cross)
-if HAS_C_UFUNCS:
- intersection = math_util.intersection
-
-
def length(A, B, degrees=True):
r"""
Returns the angular distance between two points (in vector space)
@@ -228,7 +228,7 @@ def length(A, B, degrees=True):
.. math::
- \Delta = \arccos(A \dot B)
+ \Delta = \arccos(A \cdot B)
"""
if HAS_C_UFUNCS:
result = math_util.length(A, B)
@@ -283,7 +283,7 @@ def intersects(A, B, C, D):
def intersects_point(A, B, C):
"""
- Returns True if point C is along the great circle arc AB.
+ Returns True if point C is along the great circle arc *AB*.
"""
if HAS_C_UFUNCS:
return math_util.intersects_point(A, B, C)
@@ -297,10 +297,6 @@ def intersects_point(A, B, C):
return length_diff < 1e-10
-if HAS_C_UFUNCS:
- intersects_point = math_util.intersects_point
-
-
def angle(A, B, C, degrees=True):
"""
Returns the angle at *B* between *AB* and *BC*.