From d4f92fbcfbcedd9d78a6107e0f94ba4b5f87446a Mon Sep 17 00:00:00 2001 From: jan Date: Fri, 30 Mar 2018 16:52:18 -0700 Subject: [PATCH] rename children and print voxel time --- chop/voxel.py | 6 +++--- tpy_r3d.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chop/voxel.py b/chop/voxel.py index ccdc9a1..5b83ec1 100644 --- a/chop/voxel.py +++ b/chop/voxel.py @@ -68,15 +68,15 @@ def voxelize(poly: poly_t, plane_pos = planes[axis][plane_ind] plane = (numpy.roll([-1, 0, 0], axis), plane_pos) - children = split(poly, plane) + poly_left, poly_right = split(poly, plane) slices_left = slices.copy() slices_right = slices.copy() slices_left[axis, 1] = plane_ind slices_right[axis, 0] = plane_ind + 1 - stack.append((children[0], slices_left )) - stack.append((children[1], slices_right )) + stack.append((poly_left, slices_left)) + stack.append((poly_right, slices_right)) return dest_grid diff --git a/tpy_r3d.py b/tpy_r3d.py index 40a1dee..d3baa0f 100644 --- a/tpy_r3d.py +++ b/tpy_r3d.py @@ -220,7 +220,9 @@ def test_voxelization(): edges = [numpy.linspace(-1, 3, grid_resolution) for _ in range(3)] logger.info(f'Voxelizing a tetrahedron to a grid with moments of order {POLY_ORDER}') + t0 = perf_counter() grid = voxelize(poly, edges, order=POLY_ORDER) + print(f'voxel time: {perf_counter() - t0}') visualize_voxels(grid)