  Chaos, namely exponential sensitivity to initial conditions, is generally considered a nuisance, inasmuch as it prevents long-term predictions in physical systems. Here, we present an easily accessible approach to undo deterministic chaos and tailor ray trajectories in arbitrary two-dimensional optical billiards, by introducing spatially varying refractive index therein. A new refractive index landscape is obtained by a conformal mapping, which makes the trajectories of the chaotic billiard fully predictable and the billiard fully integrable. Moreover, trajectory rectification can be pushed a step further by relating chaotic billiards with non-Euclidean geometries. Two examples are illustrated by projecting billiards built on a sphere as well as the deformed spacetime outside a Schwarzschild black hole, which respectively lead to all periodic orbits and spiraling trajectories in the resulting 2D billiards/cavities. An implementation of our method is proposed, which enables real-time control of chaos and could further contribute to a wealth of potential applications in the domain of optical microcavities. 
Ray engineering from chaos to order in two-dimensional optical cavities