def findFirstOverLappingPointForMember(memberPolyline, leaderLegToNextMember):
    logging.info("Get OverlappingPoint Index")
    memberPoints = get_points_from_polyline(memberPolyline)
    leaderPoints = get_points_from_leg(leaderLegToNextMember)
    memberIndex = 0
    leaderIndex = 0
    while len(memberPoints) > (memberIndex + 1):
        while len(leaderPoints) > (leaderIndex + 1):
            if intersect(
                memberPoints[memberIndex],
                memberPoints[memberIndex + 1],
                leaderPoints[leaderIndex],
                leaderPoints[leaderIndex + 1],
            ):
                logging.info("First Intersecting Point at " + str(memberPoints[memberIndex + 1]))
                print("intersect")
                return (memberIndex + 1), memberPoints
            elif memberPoints[memberIndex] == leaderPoints[leaderIndex]:
                logging.info("First Equal Point at " + str(memberPoints[memberIndex]))
                print("equal")
                return (memberIndex), memberPoints
            # print(str(memberPoints[memberIndex])+str(leaderPoints[leaderIndex]))
            leaderIndex += 1
        memberIndex += 1
        leaderIndex = 0

    logging.info("Failed to find a matching point")
    return None, None
def calculateLastPointInRadiusIndex(radius, location, legHeadingToNextDestination):
    logging.info("Calculate Last Point In radius")
    lastPointIndex = 0
    polyline = get_points_from_leg(legHeadingToNextDestination)
    for index, point in enumerate(polyline):
        if isPointInRadius(point, location, radius):
            lastPointIndex = index
    logging.info("Point at index " + str(index) + " is the last one in the radius")
    return polyline, lastPointIndex