Exemplo n.º 1
0
    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 
Exemplo n.º 2
0
 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)