Fixed distance function to take area into account.