rays.append([image_plane1, 10, -np.pi / 20]) rays.append([image_plane1, 10, 0]) rays.append([image_plane1, 10, np.pi / 20]) rays.append([image_plane2, 0, -np.pi / 20]) rays.append([image_plane2, 0, 0]) rays.append([image_plane2, 0, np.pi / 20]) rays.append([image_plane3, -10, -np.pi / 20]) rays.append([image_plane3, -10, 0]) rays.append([image_plane3, -10, np.pi / 20]) colors = 'rrrgggbbb' # Propagate the rays ray_bundles = rt.propagate_rays(components, rays) # Create a new canvas canvas = vis.Canvas([-200, 600], [-100, 100]) # Draw the components canvas.draw_components(components) # Draw the rays canvas.draw_rays(ray_bundles, colors) # Show the system canvas.show() # Save a copy canvas.save('schiempflug.png')
# Reimaging lens components.append(rt.Lens(f=50, aperture=100, pos=[300, -25], theta=np.pi/12)) # Get the initial rays [rays, ptdict, colors] = ray_utilities.initial_rays(scene, components[0], nrays) # Colors and three wavelengths colors = ['r'*nrays*3, 'g'*nrays*3, 'b'*nrays*3]; wavelengths = [488e-9, 514e-9, 633e-9] # Create a new canvas canvas = vis.Canvas([-200, 600], [-100, 100]) # Draw the components canvas.draw_components(components) # Draw the rays for each wavelength for idx in range(len(wavelengths)): canvas.draw_rays(rt.propagate_rays(components, rays, lmb=wavelengths[idx]), colors[idx]) # Show the system canvas.show() # Save a copy canvas.save('grating.png')