From 5fe5d2f9b116cdc789e5f3f8e90fe96eaf645e40 Mon Sep 17 00:00:00 2001 From: mcara Date: Fri, 28 Feb 2014 00:36:01 +0000 Subject: 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 --- lib/polygon.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/polygon.py') 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: -- cgit