rename children and print voxel time
This commit is contained in:
parent
ddb4f2c473
commit
d4f92fbcfb
2 changed files with 5 additions and 3 deletions
|
|
@ -68,15 +68,15 @@ def voxelize(poly: poly_t,
|
||||||
plane_pos = planes[axis][plane_ind]
|
plane_pos = planes[axis][plane_ind]
|
||||||
|
|
||||||
plane = (numpy.roll([-1, 0, 0], axis), plane_pos)
|
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_left = slices.copy()
|
||||||
slices_right = slices.copy()
|
slices_right = slices.copy()
|
||||||
slices_left[axis, 1] = plane_ind
|
slices_left[axis, 1] = plane_ind
|
||||||
slices_right[axis, 0] = plane_ind + 1
|
slices_right[axis, 0] = plane_ind + 1
|
||||||
|
|
||||||
stack.append((children[0], slices_left ))
|
stack.append((poly_left, slices_left))
|
||||||
stack.append((children[1], slices_right ))
|
stack.append((poly_right, slices_right))
|
||||||
return dest_grid
|
return dest_grid
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,9 @@ def test_voxelization():
|
||||||
|
|
||||||
edges = [numpy.linspace(-1, 3, grid_resolution) for _ in range(3)]
|
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}')
|
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)
|
grid = voxelize(poly, edges, order=POLY_ORDER)
|
||||||
|
print(f'voxel time: {perf_counter() - t0}')
|
||||||
|
|
||||||
visualize_voxels(grid)
|
visualize_voxels(grid)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue