diff options
author | mdroe <mdroe@stsci.edu> | 2012-06-05 13:30:37 -0400 |
---|---|---|
committer | mdroe <mdroe@stsci.edu> | 2012-06-05 13:30:37 -0400 |
commit | 67962ed392034cc221e928b9769e7bf98c9f6afd (patch) | |
tree | a6c73085f3eac19a8080063fb9986ce1f10f30cf /lib/test/test.py | |
parent | f502335a1a9121eeaa8bd2e06adae49c5408830a (diff) | |
download | stsci.sphere-67962ed392034cc221e928b9769e7bf98c9f6afd.tar.gz |
Some tweaks to the area calculation.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/branches/sphere@17202 fe389314-cf27-0410-b35b-8c050e845b92
Former-commit-id: 07101e1f3d5f37ea231b64b33283b8864ac1a0fc
Diffstat (limited to 'lib/test/test.py')
-rw-r--r-- | lib/test/test.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/test/test.py b/lib/test/test.py index 34b5afa..b551090 100644 --- a/lib/test/test.py +++ b/lib/test/test.py @@ -260,3 +260,18 @@ def test_cone(): ra = random.randrange(-180, 180) dec = random.randrange(20, 90) cone = polygon.SphericalPolygon.from_cone(ra, dec, 8, steps=64) + + +def test_area(): + triangles = [ + ([[90, 0], [0, -45], [0, 45], [90, 0]], np.pi * 0.5), + ([[90, 0], [0, -22.5], [0, 22.5], [90, 0]], np.pi * 0.25), + ([[90, 0], [0, -11.25], [0, 11.25], [90, 0]], np.pi * 0.125) + ] + + for tri, area in triangles: + tri = np.array(tri) + x, y, z = vector.radec_to_vector(tri[:,1], tri[:,0]) + points = np.dstack((x, y, z))[0] + poly = polygon.SphericalPolygon(points) + calc_area = poly.area() |