Example #1
0
 def __init__(self,pt = 0.0 ,xsize = 36.00, ysize = 24.0):
     """
     Constuctor with
     param pt Poistion or float, the plane position
     param xsize float xsize of plane (defaults to 36mm)
     param ysize float ysize of plane (defaults to 24 mm)
     """
     ImagePlane.__init__(self,pt,xsize,ysize)
     self.targets = []                 # List of targets
     self.wavelength = Default
Example #2
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 
Example #3
0
 def __init__(self,pt = None,xsize = 200.0, ysize = 200.0, xpixel_or_im = 256, ypixel = 256):
     """
     Form the OpticalImage with either blank array of nmpy image array
     param pt the plane point (default = None,(0,0,0))
     param xsize xsize of plane in mm (default = 200.0mm)
     param ysize ysize of plane in mm (default = 200.0mm)
     param xpixel_or_im x-pixel size of image (default = 256) OR nmpy array of floats
     param ypixel y-pixel size of of image (default = 256)
     """
     
     ImagePlane.__init__(self,pt,xsize,ysize)
     if isinstance(xpixel_or_im,int):
         self.image = np.zeros((xpixel_or_im,ypixel),dtype = float)
     else:
         self.image = xpixel_or_im
     self.xpixel,self.ypixel = self.image.shape       # set xpixel and ypixel from image data