In optics, Fermat's principle or the principle of least time is the principle that the path taken between two points by a ray of light is the path that can be traversed in the least time.
The following simulation let students play with Fermat's principle.
The ideas come from Vim Peeters:
a student should be able to choose a certain path of light between two points (which he can also use) in different optical media.
The applet would calculate the time the light needs to go from one point to another.
There are two slider on the left which can be used to adjust refraction index for both media (top/lower half).
User can drag red dot to change different path. The time for each path will be shown in the lower half panel.
Blue dot and Green dot can be drag if the drag check box is checked.