Reflection and Refraction of Light

A ray of light coming from the top left strikes the boundary surface of two media. (It is possible to choose the substances in both lists.) The medium which has the bigger index of refraction is painted blue, the other yellow. You can vary the incident ray with pressed mouse button. The app will show the reflected and the refracted ray and calculate the corresponding angles:

Angle of incidence(black)
Angle of reflection(blue)
Angle of refraction(red)
This browser doesn't support HTML5 canvas!

Remark: The index of refraction varies slightly for different wavelengths. This phenomenon is called dispersion.