setup nearest point func