minor fixes and optim

This commit is contained in:
jan 2018-04-03 15:43:11 -07:00
commit 1473633a11

View file

@ -85,7 +85,7 @@ def test_split_tets_thru_centroid():
def time_split():
NUM_TRIALS = 100_000
NUM_TRIALS = 10_000
logger.info(f'Intersecting {NUM_TRIALS} pairs of tetrahedra.')
polys = [build_rand_tetrahedron() for _ in range(NUM_TRIALS)]
facesets = [planes_from_tetrahedron(rand_tetrahedron_vertices()) for _ in range(NUM_TRIALS)]
@ -94,7 +94,7 @@ def time_split():
# clip the first tet against the faces of the second
for face in facesets[t]:
polys[t] = clip(polys[t], face)
if (t+1) % 10000 == 0:
if (t+1) % (NUM_TRIALS // 10) == 0:
t_each = (perf_counter() - t0) / (t + 1)
logger.info(f'time per split for {t+1} splits: {t_each}')
logger.info(f'done timing, time per split: {(perf_counter() - t0) / NUM_TRIALS}')
@ -224,7 +224,7 @@ def test_voxelization():
grid = voxelize(poly, edges, order=POLY_ORDER)
print(f'voxel time: {perf_counter() - t0}')
visualize_voxels(grid)
#visualize_voxels(grid)
voxsum = numpy.sum(grid, axis=(0, 1, 2))