Change voxelize to use arbitrary grid

This commit is contained in:
jan 2018-03-30 16:14:03 -07:00
commit ddb4f2c473

View file

@ -87,13 +87,10 @@ def split(poly, plane, same_only: bool = False):
'''
Some edges cross the plane
'''
right_inds3 = numpy.repeat(right_inds, 3)
# remove edges which don't also touch the left half-plane
rverts = right_inds3[far_vertex_left]
which_edges_cross, rl_edge_inds = numpy.divmod(numpy.where(far_vertex_left)[0], 3)
rverts = right_inds[which_edges_cross]
lverts = next_vertex[far_vertex_left]
if not same_only:
pinds = (numpy.arange(3 * num_right) % 3)[far_vertex_left]
num_new_vertices = rverts.size
@ -180,7 +177,7 @@ def split(poly, plane, same_only: bool = False):
old_neighbors_right = poly['neighbors'].copy()
old_neighbors_right[right] = ind_map_right[old_neighbors_right[right]]
old_neighbors_right[(rverts, pinds)] = num_right + numpy.arange(num_new_vertices)
old_neighbors_right[(rverts, rl_edge_inds)] = num_right + numpy.arange(num_new_vertices)
old_neighbors_right = old_neighbors_right[right]
right_poly = {