fixup remove_colinear_vertices
This commit is contained in:
parent
ee6699a7de
commit
5741b38ca6
@ -74,10 +74,12 @@ def remove_colinear_vertices(vertices: numpy.ndarray, closed_path: bool = True)
|
|||||||
closed path. If False, the path is assumed to be open. Default True.
|
closed path. If False, the path is assumed to be open. Default True.
|
||||||
:return:
|
:return:
|
||||||
'''
|
'''
|
||||||
|
vertices = numpy.array(vertices)
|
||||||
|
|
||||||
# Check for dx0/dy0 == dx1/dy1
|
# Check for dx0/dy0 == dx1/dy1
|
||||||
|
|
||||||
dv = numpy.roll(vertices, 1, axis=0) - vertices #[y0 - yn1, y1-y0, ...]
|
dv = numpy.roll(vertices, -1, axis=0) - vertices # [y1-y0, y2-y1, ...]
|
||||||
dxdy = dv * numpy.roll(dv, 1, axis=0)[:, ::-1] # [[dx1*dy0, dx1*dy0], ...]
|
dxdy = dv * numpy.roll(dv, 1, axis=0)[:, ::-1] #[[dx0*(dy_-1), (dx_-1)*dy0], dx1*dy0, dy1*dy0]]
|
||||||
|
|
||||||
dxdy_diff = numpy.abs(numpy.diff(dxdy, axis=1))[:, 0]
|
dxdy_diff = numpy.abs(numpy.diff(dxdy, axis=1))[:, 0]
|
||||||
err_mult = 2 * numpy.abs(dxdy).sum(axis=1) + 1e-40
|
err_mult = 2 * numpy.abs(dxdy).sum(axis=1) + 1e-40
|
||||||
|
Loading…
Reference in New Issue
Block a user