Theory and applications of distance geometry