def getWithLeastLength(path, point):
 if (len(path) < 1):
  return 0
 shortestPointIndex = None
 shortestAdditionalLength = 9.999999999876543e+17
 for pointIndex in xrange((len(path) + 1)):
  additionalLength = getAdditionalLength(path, point, pointIndex)
  if (additionalLength < shortestAdditionalLength):
   shortestAdditionalLength = additionalLength
   shortestPointIndex = pointIndex
 return shortestPointIndex

def getWithLeastLength ( path , point ) : if ( len ( path ) < 1 ) : return 0 shortestPointIndex = None shortestAdditionalLength = 9.999999999876543e+17 for pointIndex in xrange ( ( len ( path ) + 1 ) ) : additionalLength = getAdditionalLength ( path , point , pointIndex ) if ( additionalLength < shortestAdditionalLength ) : shortestAdditionalLength = additionalLength shortestPointIndex = pointIndex return shortestPointIndex
insert a point into a path .