tile was slower than modulo division

This commit is contained in:
jan 2018-03-21 12:44:18 -07:00
commit 47d6d9e978
2 changed files with 2 additions and 2 deletions

View file

@ -49,7 +49,7 @@ def split(poly, plane, left_only: bool = False):
right_inds = numpy.where(right)[0] right_inds = numpy.where(right)[0]
right_inds3 = numpy.repeat(right_inds, 3) right_inds3 = numpy.repeat(right_inds, 3)
pnbr_inds = numpy.tile(numpy.arange(3), num_right) pnbr_inds = numpy.arange(3 * num_right) % 3
# array of [[clipped vertex (cv0), connected vertex pv00], [cv0, pv01], [cv0, pv02], [cv1, pv10], ...] # array of [[clipped vertex (cv0), connected vertex pv00], [cv0, pv01], [cv0, pv02], [cv1, pv10], ...]
# which is effectively a list of all edges which touch the right half-plane # which is effectively a list of all edges which touch the right half-plane

View file

@ -35,7 +35,7 @@ def find_faces(neighbors):
num_verts = neighbors.shape[0] num_verts = neighbors.shape[0]
edge_id = numpy.arange(3 * num_verts) edge_id = numpy.arange(3 * num_verts)
nxt_edge = numpy.tile(numpy.arange(3), num_verts) nxt_edge = numpy.arange(num_verts * 3) % 3
vstart = edge_id // 3 vstart = edge_id // 3
vcur = vstart.copy() vcur = vstart.copy()
vnext = neighbors[vcur, nxt_edge] vnext = neighbors[vcur, nxt_edge]