Solution (source code)

= Solution

The <Huygens-Fresnel principle> constructs a later wavefront as the envelope of secondary wavelets emitted from the earlier one. At a planar interface, take a time interval during which one point on the incoming front travels distance $v_1\Delta t$ before reaching the interface, while the point that reached it first generates a wavelet of radius $v_2\Delta t$. The two right triangles share the interface segment, giving $\sin i/\sin r=v_1/v_2$. Since the <refractive index> is $n=c/v$, this yields <Snell's law>:
$$
\boxed{n_1\sin i=n_2\sin r.}
$$
The angles are measured from the interface <normal>. This geometric construction assumes homogeneous media and uses the propagation speeds at the given <frequency>.