Implemented nearestPointDist and equalsXYPointDist