Generalized Ray Theory for a Layered Sphere