manual linearization is faster

This commit is contained in:
jan 2018-04-05 16:44:06 -07:00
commit 7178bd88b7

View file

@ -1,7 +1,7 @@
import numpy import numpy
from . import poly_t, plane_t from . import poly_t, plane_t
from .util import build_empty, _get_map_rows from .util import build_empty, _get_map
try: try:
# Check if running with line_profiler # Check if running with line_profiler
@ -134,9 +134,12 @@ def split(poly, plane, same_only: bool = False):
# now edge_walk_results is list of [[target clipped adjacent vertex, target connected vertex], ...] # now edge_walk_results is list of [[target clipped adjacent vertex, target connected vertex], ...]
# figure out the index of each target edge... # figure out the index of each target edge using row-wise _get_map
arr = numpy.column_stack((rverts, lverts)) dims = [num_start, num_start]
target_edge_inds = _get_map_rows(arr, edge_walk_results) a1d = numpy.ravel_multi_index((rverts, lverts), dims)
b1d = numpy.ravel_multi_index(edge_walk_results.T, dims)
target_edge_inds = _get_map(a1d, b1d)
''' '''
map from old vertex ind to new map from old vertex ind to new