MCPcopy Create free account
hub / github.com/danieljfarrell/pvtrace / move_ray

Function move_ray

examples/tutorial_support.py:9–31  ·  view source on GitHub ↗
(x=0.0, y=0.0, z=0.0, theta=0.0, phi=0.0, nanometers=555.0)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 4

RayClass · 0.90
remove_objectMethod · 0.80
renderMethod · 0.80
add_ray_pathMethod · 0.80

Tested by

no test coverage detected