Improve h2spatial-ext/distance-functions