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')
theta=0)) # Add a field lens components.append(rt.Lens(f=f_field, aperture=aperture, pos=[ffl,0], theta=0)) # Get initial rays [rays, ptdict, colors] = ray_utilities.initial_rays(scene, components[0], nrays) # Propagate the rays ray_bundles = rt.propagate_rays(components, rays) # Create a new canvas canvas = vis.Canvas([image_plane, 150], [ymin, ymax]) # Draw the rays canvas.draw_rays(ray_bundles, colors) # Draw the components canvas.draw_components(components) # Show the canvas canvas.show() # Save the canvas canvas.save('field_lens.png')
# Second lens creates the flange focal distance components.append(rt.Lens(f=-13, aperture=50, pos=[20, 0], theta=0)) # Create three points and three rays from each point rays += ray_utilities.ray_fan([image_plane, 200], [-np.pi / 5, -np.pi / 6], nrays) rays += ray_utilities.ray_fan([image_plane, 0], [-np.pi / 30, np.pi / 30], nrays) rays += ray_utilities.ray_fan([image_plane, -200], [np.pi / 6, np.pi / 5], nrays) colors = 'r' * nrays + 'g' * nrays + 'b' * nrays # Propagate the rays ray_bundles = rt.propagate_rays(components, rays) # Create a new canvas canvas = vis.Canvas([-300, 100], [-200, 200]) # 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('objective.png')
components.append(rt.Mirror( aperture=300, pos=[300,0], theta=0)) rays = [] n1 = 180/float(angle[0]) n2 = 180/float(angle[1]) rays.append([75, 100, -(np.pi/2 - np.pi/n1)]) rays.append([125, 100, -(np.pi/2 - np.pi/n2)]) ray_bundles = rt.propagate_rays(components, rays) # Color for the rays colors = ['r','b'] # Create a new canvas canvas = vis.Canvas([-100, 300], [-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('example.png')