Light, traced through the glass.

Lenses, prisms, mirrors and scattering media in a world file. Sweep a setting, and every trial is a run on the record.

Move the lensScroll moves the page. Click in to use the wheel and keys.Esc gives the page back.

world.tsx
Simulado: un rayo blanco llega por la izquierda a un prisma de vidrio, lo atraviesa paralelo a su base y sale como tres rayos, rojo, verde y azul, que se separan poco a poco hacia la derecha.

Try it live

Live. The lens bench that ships with the workbench: move the lens and the spot moves with it.

Case study 1 · a ball lens

The sharpest spot is not at the focus.

A parallel beam, 12 mm wide, meets a 20 mm ball of N-BK7 glass. The paraxial formula puts the focus 4.67 mm behind the ball. The trials move the screen in 26 steps and measure the spot each time. The outer rays bend more, so they cross first, and the smallest spot is nearer the ball.

rms spot at its smallest, 3.7 mm behind the ball
116 µm
nearer the ball than the paraxial focus
0.97 mm
wider spot at the paraxial focus (302 µm)
2.6×
trials, one simulated run each
26

Simulated

Simulado: 41 rayos verdes paralelos entran por la izquierda en una bola de vidrio de 20 mm, se desvían en las dos caras y se cruzan justo detrás; los rayos exteriores se cruzan más cerca de la bola que los interiores.
ProcedenciaArchivo cloud://home/user-commandagi/case-studies/optics/ball-lens/focus.trials.jsonEjecución runs/20261104t161917z-iodeHerramienta sim-optics.js, the trial runnerSe ejecutó en This computer (dell-gb10-1)Cuándo

The sweep

Each trial is one point of the curve.

The sweep run's outcomes stream holds one record per trial: the screen's place, the rms width and the trial's own run. The curve is those records.

Open a lens bench

The spot's rms width behind the ball lens
Los números
The spot's rms width behind the ball lens
Screen behind the ball (mm)rms spot width
1.5619 µm
1.7564 µm
1.9510 µm
2.1456 µm
2.3403 µm
2.5350 µm
2.7299 µm
2.9248 µm
3.1201 µm
3.3159 µm
3.5128 µm
3.7116 µm
3.9129 µm
4.1162 µm
4.3204 µm
4.5252 µm
4.7302 µm
4.9354 µm
5.1407 µm
5.3460 µm
5.5514 µm
5.7568 µm
5.9623 µm
6.1677 µm
6.3732 µm
6.5787 µm
ProcedenciaArchivo cloud://home/user-commandagi/case-studies/optics/ball-lens/focus.trials.jsonEjecución runs/20261104t161917z-iodeCuándo

Case study 2 · a prism

The trace agrees with the closed form to 0.0001°.

A 30 mm equilateral prism of N-BK7 splits blue, green and red light. The trials turn the beam in 29 steps. At the smallest deviation the ray inside runs parallel to the base, and the textbook gives δ = 2 asin(n sin 30°) − 60° exactly. The trace finds the same angle.

smallest deviation of green (530 nm), traced
38.8888°
the same angle in closed form
38.8889°
between blue (450 nm) and red (650 nm) at that angle
0.95°
trials in two sweeps
58

Simulated

Simulado: un rayo blanco llega por la izquierda a un prisma de vidrio, lo atraviesa paralelo a su base y sale como tres rayos, rojo, verde y azul, que se separan poco a poco hacia la derecha.
ProcedenciaArchivo cloud://home/user-commandagi/case-studies/optics/prism/deviation.trials.jsonEjecución runs/20261104t161918z-1y5nHerramienta sim-optics.js, the trial runnerSe ejecutó en This computer (dell-gb10-1)Cuándo

The sweep

Steeper light, a wider fan.

The second sweep scores the angle between blue and red. The fan is widest when the beam meets the face at a steep angle, and it narrows as the beam turns past the angle of smallest deviation.

  • The kernel is sequential and analytic: Snell's law, Cauchy dispersion, Fresnel splitting, Beer–Lambert absorption and Henyey–Greenstein scattering. It has no diffraction, thin films or polarization.
  • A simulated trial is evidence about the model, never about a real lens.
Green's deviation and the blue–red fan against the beam's angle
Los números
Green's deviation and the blue–red fan against the beam's angle
Beam angle (°)Green's deviation − 38°Blue–red fan
9.22.94°1.25°
10.32.45°1.19°
11.52.05°1.14°
12.61.71°1.1°
13.81.45°1.07°
14.91.24°1.04°
161.08°1.01°
17.20.97°0.99°
18.30.908°0.97°
19.50.889°0.952°
20.60.91°0.936°
21.80.97°0.922°
22.91.07°0.909°
24.11.2°0.898°
25.21.36°0.888°
26.41.56°0.879°
27.51.8°0.871°
28.62.06°0.864°
29.82.36°0.858°
30.92.69°0.852°
32.13.04°0.847°
33.23.43°0.843°
34.43.85°0.839°
35.54.3°0.836°
36.74.79°0.833°
37.85.3°0.83°
395.84°0.828°
40.16.41°0.826°
41.37.01°0.824°
ProcedenciaArchivo cloud://home/user-commandagi/case-studies/optics/prism/spread.trials.jsonEjecución runs/20261104t161918z-f943Cuándo

Trace your own glass.

A bench is a few lines of a world file. Describe it, or write it, and sweep any number in it.