def __HittingBBoxs(self, pt, vd): tMin = 0 tMax = float('inf') hits = [] for bboxId in range(self.getObjectsCount()): bbox = self.bboxsList[bboxId] faces=bbox.getTriangles() points=bbox.getVertices() isIntersect, t = Utils.rayIntersectObject(pt, vd, faces, points, tMin, tMax) if isIntersect: hits.append(bboxId) return hits
def __intersect(self, pt, vd, tMin, tMax): isHit = False hitT = False hits = self.__HittingBBoxs(pt, vd) for hitId in range(hits): faces = self.facesList[hitId] points = self.pointsList[hitId] isIntersect, t = Utils.rayIntersectObject(pt, vd, faces, points, tMin, tMax) if isIntersect: isHit = True tMax = t hitT = t return (isHit, hitT)