How is the distance calculated?