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
仿真:一条白色光线从左侧射入玻璃棱镜,在棱镜内平行于底边传播,射出后分成红、绿、蓝三条光线,向右逐渐分开。

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

仿真:41 条平行的绿色光线从左侧射入一个 20 mm 的玻璃球,在两个表面折射后在球后方交汇;外侧光线的交汇点比内侧光线更靠近球。
来源文件 cloud://home/user-commandagi/case-studies/optics/ball-lens/focus.trials.json运行 runs/20261104t161917z-iode工具 sim-optics.js, the trial runner运行于 This computer (dell-gb10-1)时间

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
数据
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
来源文件 cloud://home/user-commandagi/case-studies/optics/ball-lens/focus.trials.json运行 runs/20261104t161917z-iode时间

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

仿真:一条白色光线从左侧射入玻璃棱镜,在棱镜内平行于底边传播,射出后分成红、绿、蓝三条光线,向右逐渐分开。
来源文件 cloud://home/user-commandagi/case-studies/optics/prism/deviation.trials.json运行 runs/20261104t161918z-1y5n工具 sim-optics.js, the trial runner运行于 This computer (dell-gb10-1)时间

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
数据
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°
来源文件 cloud://home/user-commandagi/case-studies/optics/prism/spread.trials.json运行 runs/20261104t161918z-f943时间

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.