[remove_colinear_vertices] keep two vertices if all were colinear
This commit is contained in:
parent
f64b080b15
commit
05098c0c13
1 changed files with 4 additions and 0 deletions
|
|
@ -51,6 +51,10 @@ def remove_colinear_vertices(vertices: ArrayLike, closed_path: bool = True) -> N
|
|||
if not closed_path:
|
||||
slopes_equal[[0, -1]] = False
|
||||
|
||||
if slopes_equal.all() and vertices.shape[0] > 0:
|
||||
# All colinear, keep the first and last
|
||||
return vertices[[0, vertices.shape[0] - 1]]
|
||||
|
||||
return vertices[~slopes_equal]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue