Allow polygon to take a list or tuple and add a test

This commit is contained in:
Steven Silvester
2015-09-05 20:18:55 -05:00
parent 9e4d0eebdd
commit 98877016f3
2 changed files with 3 additions and 2 deletions
+2
View File
@@ -268,6 +268,8 @@ def polygon(y, x, shape=None):
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
"""
x = np.asanyarray(x)
y = np.asanyarray(y)
cdef Py_ssize_t nr_verts = x.shape[0]
cdef Py_ssize_t minr = int(max(0, y.min()))
+1 -2
View File
@@ -122,9 +122,8 @@ def test_line_equal_aliasing_horizontally_vertically():
def test_polygon_rectangle():
img = np.zeros((10, 10), 'uint8')
poly = np.array(((1, 1), (4, 1), (4, 4), (1, 4), (1, 1)))
rr, cc = polygon(poly[:, 0], poly[:, 1])
rr, cc = polygon((1, 4, 4, 1, 1), (1, 1, 4, 4, 1))
img[rr, cc] = 1
img_ = np.zeros((10, 10))