Improve h2spatial-ext/distance-functions

@mlecoeuvre Please see these corrections