From a0d79e729df125baa1153412d4e8794e7efac63e Mon Sep 17 00:00:00 2001 From: jan Date: Wed, 28 Mar 2018 18:49:08 -0700 Subject: [PATCH] speedup using _get_map_rows --- chop/split.py | 8 ++------ chop/voxel.py | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/chop/split.py b/chop/split.py index 1e05fcf..c732082 100644 --- a/chop/split.py +++ b/chop/split.py @@ -1,7 +1,7 @@ import numpy from . import poly_t, plane_t -from .util import _searchsorted_rows, _argsort_rows, build_empty +from .util import build_empty, _get_map_rows try: # 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 = 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] ''' @@ -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], ...] # 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] le = r2l_edges[:, 1] diff --git a/chop/voxel.py b/chop/voxel.py index 47bffc1..c219deb 100644 --- a/chop/voxel.py +++ b/chop/voxel.py @@ -21,9 +21,9 @@ def voxelize(poly: poly_t, ) -> numpy.ndarray: ''' Voxelize a Schelegel-representation polyhedron - - ''' + + #TODO: COMMENT THIS FILE! box = get_box(poly, d) if box is None else numpy.array(box, dtype=int) d = numpy.array(d)