def is_passed_counting_roi(current_point, first_point, roi_polygon, roi_outside, is_enter):
    """
    will check if the point passed the counting roi. if the current location in the roi and the first location not in the roi - it passed
    if the current location not in the roi and the first location in the roi - it passed.
    :param current_point: Point object for the current location
    :param first_point: Point object for the first detected location.
    :param roi_polygon: Polygon object for the counting roi.
    :param roi_outside: True if the roi if the outside.
    :param is_enter: True if we want to check if the person enter to the roi and false if we want to check if the person left the roi.
    :return: True if the point passed the roi , False if the point not passed the roi.
    """
    if roi_outside ^ is_enter:
        return roi_polygon.contains(current_point) and not roi_polygon.contains(first_point)
    else:
        return roi_polygon.contains(first_point) and not roi_polygon.contains(current_point)