Comment and error-checking fixes

This commit is contained in:
Jan Petykiewicz 2019-04-20 14:19:18 -07:00
parent 8fe8bbd655
commit d53c9487ff

View File

@ -13,7 +13,8 @@ __author__ = 'Jan Petykiewicz'
class Polygon(Shape): class Polygon(Shape):
""" """
A polygon, consisting of a bunch of vertices (Nx2 ndarray) along with an offset. A polygon, consisting of a bunch of vertices (Nx2 ndarray) which specify an
implicitly-closed boundary, and an offset.
A normalized_form(...) is available, but can be quite slow with lots of vertices. A normalized_form(...) is available, but can be quite slow with lots of vertices.
""" """
@ -35,14 +36,14 @@ class Polygon(Shape):
if len(val.shape) < 2 or val.shape[1] != 2: if len(val.shape) < 2 or val.shape[1] != 2:
raise PatternError('Vertices must be an Nx2 array') raise PatternError('Vertices must be an Nx2 array')
if val.shape[0] < 3: if val.shape[0] < 3:
raise PatternError('Must have at least 3 vertices (Nx2, N>3)') raise PatternError('Must have at least 3 vertices (Nx2 where N>2)')
self._vertices = val self._vertices = val
# xs property # xs property
@property @property
def xs(self) -> numpy.ndarray: def xs(self) -> numpy.ndarray:
""" """
All x vertices in a 1D ndarray All vertex x coords as a 1D ndarray
""" """
return self.vertices[:, 0] return self.vertices[:, 0]
@ -57,7 +58,7 @@ class Polygon(Shape):
@property @property
def ys(self) -> numpy.ndarray: def ys(self) -> numpy.ndarray:
""" """
All y vertices in a 1D ndarray All vertex y coords as a 1D ndarray
""" """
return self.vertices[:, 1] return self.vertices[:, 1]