Geometrical optics of inhomogeneous media