(x=0.0, y=0.0, z=0.0, theta=0.0, phi=0.0, nanometers=555.0)
| 7 | ray_ids = [] |
| 8 | |
| 9 | def move_ray(x=0.0, y=0.0, z=0.0, theta=0.0, phi=0.0, nanometers=555.0): |
| 10 | # Clear old objects |
| 11 | [vis.remove_object(_id) for _id in ray_ids] |
| 12 | |
| 13 | # Create new array with position from the interact UI |
| 14 | ray = Ray( |
| 15 | position=(x, y, z), |
| 16 | direction=( |
| 17 | np.sin(np.radians(theta)) * np.cos(np.radians(phi)), |
| 18 | np.sin(np.radians(theta)) * np.sin(np.radians(phi)), |
| 19 | np.cos(np.radians(theta)) |
| 20 | ), |
| 21 | wavelength=nanometers |
| 22 | ) |
| 23 | |
| 24 | # Re-create the scene with the new ray but reuse the renderers |
| 25 | steps = photon_tracer.follow(scene, ray, maxsteps=10) |
| 26 | path, events = zip(*steps) |
| 27 | vis.render(scene) |
| 28 | |
| 29 | # Remove old rays; add new rays |
| 30 | ray_ids.clear() |
| 31 | ray_ids.extend(vis.add_ray_path(path)) |
| 32 | |
| 33 | return interact( |
| 34 | move_ray, |
nothing calls this directly
no test coverage detected