fix final assignment and clarify what's going

This commit is contained in:
Jan Petykiewicz 2024-07-28 19:37:20 -07:00
parent d5adf57bc6
commit 01fe53dc79

View File

@ -266,11 +266,12 @@ class Shape(PositionableImpl, Rotatable, Mirrorable, Copyable, Scalable,
mins, maxs = bounds mins, maxs = bounds
keep_x = numpy.logical_and(grx > mins[0], grx < maxs[0]) keep_x = numpy.logical_and(grx > mins[0], grx < maxs[0])
keep_y = numpy.logical_and(gry > mins[1], gry < maxs[1]) keep_y = numpy.logical_and(gry > mins[1], gry < maxs[1])
for k in (keep_x, keep_y): # Flood left & rightwards by 2 cells
for s in (1, 2): for kk in (keep_x, keep_y):
k[s:] += k[:-s] for ss in (1, 2):
k[:-s] += k[s:] kk[ss:] += kk[:-ss]
k = k > 0 kk[:-ss] += kk[ss:]
kk[:] = kk > 0
gx = grx[keep_x] gx = grx[keep_x]
gy = gry[keep_y] gy = gry[keep_y]