summaryrefslogtreecommitdiff
path: root/stsci/sphere/test/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'stsci/sphere/test/test.py')
-rw-r--r--stsci/sphere/test/test.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/stsci/sphere/test/test.py b/stsci/sphere/test/test.py
index 5ab7bbb..567ec1d 100644
--- a/stsci/sphere/test/test.py
+++ b/stsci/sphere/test/test.py
@@ -276,3 +276,34 @@ def test_area():
points = np.dstack((x, y, z))[0]
poly = polygon.SphericalPolygon(points)
calc_area = poly.area()
+
+
+def test_fast_area():
+ a = np.array( # Clockwise
+ [[ 0.35327617, 0.6351561 , -0.6868571 ],
+ [ 0.35295533, 0.63510299, -0.68707112],
+ [ 0.35298984, 0.63505081, -0.68710162],
+ [ 0.35331262, 0.63510039, -0.68688987],
+ [ 0.35327617, 0.6351561 , -0.6868571 ]])
+
+ b = np.array([ # Clockwise
+ [ 0.35331737, 0.6351013 , -0.68688658],
+ [ 0.3536442 , 0.63515101, -0.68667239],
+ [ 0.35360581, 0.63521041, -0.68663722],
+ [ 0.35328338, 0.63515742, -0.68685217],
+ [ 0.35328614, 0.63515318, -0.68685467],
+ [ 0.35328374, 0.63515279, -0.68685627],
+ [ 0.35331737, 0.6351013 , -0.68688658]])
+
+ c = np.array([ # Counterclockwise
+ [ 0.35331737, 0.6351013 , -0.68688658],
+ [ 0.35328374, 0.63515279, -0.68685627],
+ [ 0.35328614, 0.63515318, -0.68685467],
+ [ 0.35328338, 0.63515742, -0.68685217],
+ [ 0.35360581, 0.63521041, -0.68663722],
+ [ 0.3536442 , 0.63515101, -0.68667239],
+ [ 0.35331737, 0.6351013 , -0.68688658]])
+
+ assert graph.Graph._fast_area(a) > 0
+ assert graph.Graph._fast_area(b) > 0
+ assert graph.Graph._fast_area(c) < 0