def torus_faces(x, y):
faces = np.empty((x * y, 4), dtype=np.uint32)
tmp = np.arange(0, x * y)
faces[:, 0] = tmp
faces[:, 1] = np.roll(tmp, -y)
tmp += 1
tmp.shape = (x, y)
tmp[:, y - 1] -= y
tmp.shape = -1
faces[:, 3] = tmp
faces[:, 2] = np.roll(tmp, -y)
faces.shape = -1
l_total = np.empty(x * y, dtype=np.uint32)
l_total[:] = 4
l_start = np.arange(0, (x * y) * 4, 4, dtype=np.uint32)
return SvPolygon(l_start, l_total, faces)
评论列表
文章目录