The light source is the purple dot in medium 2. The light is incident on the interface between the two media at the position of the green dot, which is fixed. The critical angle is marked by the angled black lines in one of the media. When the angle of incidence is less than or equal to the critical angle for that interface, some of the light reflects back into medium 2, and some refracts into medium 1. If the angle of incidence exceeds the critical angles, however, total internal reflection occurs, and the light remains in medium 2, bouncing off the interfaces as it proceeds along the medium.
This is how an optical fiber works. This has many practical applications, ranging from the fiber optic cables that carry many of the internet signals around the world, to an endoscope, in which light is transmitted along an optical fiber, an an image of somewhere inside the human body is transmitted back.
Simulation first posted on 2-27-2017. Written by Andrew Duffy