distance calculated by grid lines