transpose for cleaner code
This commit is contained in:
parent
7178bd88b7
commit
5bb2d2464f
1 changed files with 3 additions and 4 deletions
|
|
@ -107,7 +107,7 @@ def split(poly, plane, same_only: bool = False):
|
|||
prev_verts = rverts
|
||||
cur_verts = lverts
|
||||
edge_walk_inds = numpy.arange(num_new_vertices)
|
||||
edge_walk_results = numpy.empty((num_new_vertices, 2), dtype=int)
|
||||
edge_walk_results = numpy.empty((2, num_new_vertices), dtype=int)
|
||||
src_pns = None
|
||||
while cur_verts.size > 0:
|
||||
# Get the list of our current neighbors, find which one points to the
|
||||
|
|
@ -123,8 +123,7 @@ def split(poly, plane, same_only: bool = False):
|
|||
|
||||
# Save edges that cross back to right, and remove them from the list of verts
|
||||
done = right[next_verts]
|
||||
edge_walk_results[edge_walk_inds[done], 1] = cur_verts[done]
|
||||
edge_walk_results[edge_walk_inds[done], 0] = next_verts[done]
|
||||
edge_walk_results[:, edge_walk_inds[done]] = (next_verts[done], cur_verts[done])
|
||||
|
||||
# Save the current vertices as previous, and our chosen neighbors as current
|
||||
not_done = numpy.logical_not(done)
|
||||
|
|
@ -137,7 +136,7 @@ def split(poly, plane, same_only: bool = False):
|
|||
# figure out the index of each target edge using row-wise _get_map
|
||||
dims = [num_start, num_start]
|
||||
a1d = numpy.ravel_multi_index((rverts, lverts), dims)
|
||||
b1d = numpy.ravel_multi_index(edge_walk_results.T, dims)
|
||||
b1d = numpy.ravel_multi_index(edge_walk_results, dims)
|
||||
target_edge_inds = _get_map(a1d, b1d)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue