def __init__(self, xgeo): self.xgeo = xgeo self.bits = 0 self.lst = [] self.minIdx = -1 self.maxIdx = -1 self.bbox = xh.BBox() self.maxWgtNum = 0 self.skinBits = 0 self.skinNodes = []
def __init__(self, xgeo): self.xgeo = xgeo self.bbox = xh.BBox() self.bbox.fromHouBBox(self.xgeo.bbox) npol = self.xgeo.polNum self.polIds = [i for i in xrange(npol)] self.nodeLst = [] self.nodeMap = {} self.root = BVHNode(self) self.root.build(0, npol, self.bbox.getMaxAxis(), 0)
def build(self, idx, count, axis, lvl): self.lvl = lvl if count == 1: self.addPols(idx, count) elif count == 2: self.left = BVHNode(self.bvh) self.left.addPols(idx, 1) self.left.lvl = lvl + 1 self.right = BVHNode(self.bvh) self.right.addPols(idx + 1, 1) self.bbox = xh.BBox() self.bbox.addBox(self.left.bbox) self.bbox.addBox(self.right.bbox) self.right.lvl = lvl + 1 else: self.bbox = xh.BBox() for i in xrange(count): self.bbox.addBox(self.bvh.getPolBBox(idx + i)) mid = self.bvh.split(idx, count, self.bbox.getCenter()[axis], axis) nextAxis = (axis + 1) % 3 self.left = BVHNode(self.bvh) self.right = BVHNode(self.bvh) self.left.build(idx, mid, nextAxis, lvl + 1) self.right.build(idx + mid, count - mid, nextAxis, lvl + 1)
def __init__(self, xgeo, prim): self.xgeo = xgeo self.prim = prim self.pntLst = [] self.mtlId = -1 self.bbox = xh.BBox() for vtx in prim.vertices(): pnt = vtx.point() self.pntLst.append(pnt.number()) pos = pnt.position() self.bbox.addPos(pos) self.vtxNum = len(self.pntLst) self.grpNum = 0 self.grpMinIdx = 0 self.grpMaxIdx = 0 self.grpMask = 0 self.grpLst = []
def addPols(self, idx, count): self.bbox = xh.BBox() for i in xrange(count): self.bbox.addBox(self.bvh.getPolBBox(idx + i)) self.polIdLst.append(self.bvh.getPolId(idx + i))