Ported nearest_point() and nearest_point_index()