This question already has an answer here:
From my understanding of Fermat's Principle, you decide a start point and an end point for a light ray to travel between, and the light 'chooses' whichever path takes the least time (or technically whichever path the time is 'stationary' at).
So consider the following, you set up the start point, A, and the end point, B in different mediums. Of course the path of minimum time is that which obeys snells law.
However if the light is coming from box which has only has a small hole in it (as shown in the diagram), the light is unable to follow this path of least time. But it is still the path of least time, so why is Fermat's principle no longer obeyed?
Does Fermat's Principle simply not apply for when there are objects that can block/absorb the light? Do we therefore assume that light is able to reach every point in space when using Fermat's Principle? If so, what is the point othe principle?