Get distance from first point and choose nearest one
d = getDistance ( points [ i ] [ 0 ] , points [ i ] [ 1 ] , points [ first ] [ 0 ] , points [ first ] [ 1 ] ) NEW_LINE if minD > d : NEW_LINE INDENT minD = d NEW_LINE second = i NEW_LINE DEDENT