The Heat Method for Distance Computation