def __init__(self, base, width, bm, indices, max_triangles, min_width):
self.half_width = width / 2.0
self.c = base + Vector((self.half_width, self.half_width, self.half_width))
self.is_leaf = True
self.indices = []
for i in indices:
# TODO: Maybe solving it with a Wiimm KCL_BLOW approach is faster.
if self.tricube_overlap(bm.faces[i], self):
self.indices.append(i)
# Split this node's cube when it contains too many triangles and the minimum size is not underrun yet.
if len(self.indices) > max_triangles and self.half_width >= min_width:
self.is_leaf = False
self.branches = [KclModel.OctreeNode(base + (Vector((x, y, z)) * self.half_width), self.half_width,
bm, self.indices,
max_triangles, min_width)
for z in range(0, 2) for y in range(0, 2) for x in range(0, 2)]
self.indices = []
评论列表
文章目录