summaryrefslogtreecommitdiff
path: root/lib/polygon.py
diff options
context:
space:
mode:
authormcara <mcara@stsci.edu>2014-02-27 19:36:01 -0500
committermcara <mcara@stsci.edu>2014-02-27 19:36:01 -0500
commit5fe5d2f9b116cdc789e5f3f8e90fe96eaf645e40 (patch)
treed5bd3ee487126c66395d709771e0d30b5fa58f1f /lib/polygon.py
parent90cf3598c6e74993e26fe8087bd54425106ed077 (diff)
downloadstsci.sphere-5fe5d2f9b116cdc789e5f3f8e90fe96eaf645e40.tar.gz
Restored the old implementation of the SphericalPolygon.__init__(...) for the case of empty list of points which was designed to remove a RuntimeWarning at the first run of the code (see Ticket # 1079). For unknown reasons, this change was lost during last commit by Mike.
Moved point vector-normalization from the add_node method to Node.__init__(...) in graph.py. Removed skyline.py from the 'sphere' module. The original implementation of skyline.py did not work correctly (see, e.g., tickets #1080, #1081, #1082) and overall it makes sense to separate image processing and statistical analysis from "pure" geometric operations handled by the 'sphere'. git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/branches/sphere@29976 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: 82f06f5b25c8cc262bfbc0b57e3e774d320bcf47
Diffstat (limited to 'lib/polygon.py')
-rw-r--r--lib/polygon.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/polygon.py b/lib/polygon.py
index b20e0b1..e9ad379 100644
--- a/lib/polygon.py
+++ b/lib/polygon.py
@@ -78,12 +78,18 @@ class SphericalPolygon(object):
mean of the points will be used.
"""
if len(points) == 0:
- pass
+ # handle special case of initializing with an empty list of
+ # vertices (ticket #1079).
+ self._inside = np.zeros(3)
+ self._points = np.asanyarray(points)
+ return
elif len(points) < 3:
raise ValueError("Polygon made of too few points")
else:
assert np.array_equal(points[0], points[-1]), 'Polygon is not closed'
+
self._points = np.asanyarray(points)
+
if inside is None:
self._inside = np.mean(points[:-1], axis=0)
else: