computing distance between two meshes