예제 #1
0
    def getSurfaceInteraction(self,r):
        """
        Method to get back the surface interaction information for a ray
        Returns the list
        type:     surface type
        distance: distance from current ray position to surface
        pos :     Position, intration point with surface
        norm:     surface normal at that point
        refrative : refrative index (if refracting surface)

        This also add the ray intensity to the cloeset pixel
        """
        
        #       get interaction with super class
        info = ImagePlane.getSurfaceInteraction(self,r)
        
        #            Add ray to pixel
        i = int(round(self.xpixel*(info.position.x + self.xsize/2 - info.point.x)/self.xsize))
        j = int(round(self.ypixel*(info.position.y + self.ysize/2 - info.point.y)/self.ysize))

        #          Check if pixel is in image (note due to distrortions it may not be)
        if i >= 0 and i < self.xpixel and j >=0 and j < self.ypixel:
            self.image[i,j] += r.intensity               # Add it to the image

        #          Retun info to calling object
        return info