Measuring distance to celestial bodies