How to use Hausdorff distance to compare geometries

124 Views Asked by At

I implemented a Hausdorff distance algorithm for a collection of $[[x_1,y_2], [x_n,y_n]]$ vertices. My question is, how do I interpret this distance? Is there an additional step need to help determine polygon similarity?

from_array = np.array([[0,1], [2,4], [4,4], [0,1]])
to_array = np.array([[1,2], [3,5], [0,1], [1,2]])

def hausdorff(from_array, to_array):
    subs = from_array[:,None] - to_array
    sq_eucliean_dist = np.einsum('ijk,ijk->ij',subs,subs)
    eucliean_dist = np.sqrt(sq_eucliean_dist)
    fhd = np.mean(np.min(eucliean_dist,axis=0))
    rhd = np.mean(np.min(eucliean_dist,axis=1))
    return max(fhd,rhd)

The distance is 1.06066017178, but I'm struggling to find some meaning to this number.

Thank you