Snell's law is a formula used to describe the relationship between the angles of incidence and refraction, when referring to light or other waves passing through a boundary between two different isotropic media, such as water, glass, or air. In optics, the law is used in ray tracing to compute the angles of incidence or refraction, and in experimental optics to find the refractive index of a material. The law is also satisfied in meta-materials, which allow light to be bent "backward" at a negative angle of refraction with a negative refractive index.

The law states that, for a given pair of media, the ratio of the sines of angle of incidence ( $\theta_1$ ) and angle of refraction ( $\theta_2$ ) is equal to the refractive index of the second medium with regard to the first ( $n_{21}$ ) which is equal to the ratio of the refractive indices $\left(\frac{n_2}{n_1}\right)$ of the two media, or equivalently, to the ratio of the phase velocities $\left(\frac{v_1}{v_2}\right)$ in the two media.

$$ \frac{\sin \theta_1}{\sin \theta_2}=n_{21}=\frac{n_2}{n_1}=\frac{v_1}{v_2} $$

The law follows from Fermat's principle of least time, which in turn follows from the propagation of light as waves.

🧠Simulation

https://gist.github.com/viadean/ff8b62acae862742a9cc34a99647b496

Output

Angle of refraction: 28.13 degrees
Total internal reflection occurs.

Fig 1

Fig 1

Fig 2

Fig 2

Fig 3

Fig 3