def getClosestDistanceIndexToPoint(point, loop):
 smallestDistance = 9.876543219876543e+17
 closestDistanceIndex = None
 pointComplex = point.dropAxis()
 for (otherPointIndex, otherPoint) in enumerate(loop):
  distance = abs((pointComplex - otherPoint.dropAxis()))
  if (distance < smallestDistance):
   smallestDistance = distance
   closestDistanceIndex = euclidean.DistanceIndex(distance, otherPointIndex)
 return closestDistanceIndex

def getClosestDistanceIndexToPoint ( point , loop ) : smallestDistance = 9.876543219876543e+17 closestDistanceIndex = None pointComplex = point . dropAxis ( ) for ( otherPointIndex , otherPoint ) in enumerate ( loop ) : distance = abs ( ( pointComplex - otherPoint . dropAxis ( ) ) ) if ( distance < smallestDistance ) : smallestDistance = distance closestDistanceIndex = euclidean . DistanceIndex ( distance , otherPointIndex ) return closestDistanceIndex
get the distance squared to the closest point of the loop and index of that point .