mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
make loop condition more readable
This commit is contained in:
committed by
Stefan van der Walt
parent
74b358af82
commit
add94d24ce
@@ -33,8 +33,9 @@ def approximate_polygon(coords, tolerance):
|
||||
chain[0] = True
|
||||
chain[-1] = True
|
||||
pos_stack = [(0, chain.shape[0] - 1)]
|
||||
end_of_chain = False
|
||||
|
||||
while 1:
|
||||
while not end_of_chain:
|
||||
start, end = pos_stack.pop()
|
||||
# determine properties of current line segment
|
||||
r0, c0 = coords[start, :]
|
||||
@@ -83,6 +84,6 @@ def approximate_polygon(coords, tolerance):
|
||||
chain[new_end] = True
|
||||
|
||||
if len(pos_stack) == 0:
|
||||
break
|
||||
end_of_chain = True
|
||||
|
||||
return coords[chain, :]
|
||||
|
||||
Reference in New Issue
Block a user