speedup using _get_map_rows
This commit is contained in:
parent
f5d2e5f6fc
commit
a0d79e729d
2 changed files with 4 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
from . import poly_t, plane_t
|
from . import poly_t, plane_t
|
||||||
from .util import _searchsorted_rows, _argsort_rows, build_empty
|
from .util import build_empty, _get_map_rows
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Check if running with line_profiler
|
# Check if running with line_profiler
|
||||||
|
|
@ -96,10 +96,6 @@ def split(poly, plane, same_only: bool = False):
|
||||||
r2l_edges = numpy.column_stack((right_inds3, next_vertex, pnbr_inds))
|
r2l_edges = numpy.column_stack((right_inds3, next_vertex, pnbr_inds))
|
||||||
r2l_edges = r2l_edges[far_vertex_left, :] # remove edges which don't also touch the left half-plane
|
r2l_edges = r2l_edges[far_vertex_left, :] # remove edges which don't also touch the left half-plane
|
||||||
|
|
||||||
# sort now so we can use searchsorted later
|
|
||||||
r2l_edge_order = _argsort_rows(r2l_edges[:, :2])
|
|
||||||
r2l_edges = r2l_edges[r2l_edge_order]
|
|
||||||
|
|
||||||
num_new_vertices = r2l_edges.shape[0]
|
num_new_vertices = r2l_edges.shape[0]
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
@ -136,7 +132,7 @@ 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...
|
||||||
target_edge_inds = _searchsorted_rows(r2l_edges[:, :2], edge_walk_results)
|
target_edge_inds, _ = _get_map_rows(r2l_edges[:, :2], edge_walk_results)
|
||||||
|
|
||||||
re = r2l_edges[:, 0]
|
re = r2l_edges[:, 0]
|
||||||
le = r2l_edges[:, 1]
|
le = r2l_edges[:, 1]
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ def voxelize(poly: poly_t,
|
||||||
) -> numpy.ndarray:
|
) -> numpy.ndarray:
|
||||||
'''
|
'''
|
||||||
Voxelize a Schelegel-representation polyhedron
|
Voxelize a Schelegel-representation polyhedron
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
#TODO: COMMENT THIS FILE!
|
||||||
box = get_box(poly, d) if box is None else numpy.array(box, dtype=int)
|
box = get_box(poly, d) if box is None else numpy.array(box, dtype=int)
|
||||||
d = numpy.array(d)
|
d = numpy.array(d)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue