Pass in an Action to the overloaded constructor so the user can use their own distance function. Default to the existing one.