Electromagnetic theory and geometrical optics