def pointOnSegment(p1, p2, p3):
    """
    # Checks if p2 lies on segment p1-p3.
    :param:
        p1, p2, P3: np.array as [x, y, s] - points
    :return: bool - True of p2 is on  the p1-p3 .segment
    """
    if (p2[0] <= max(p1[0], p3[0]) and (p2[0] >= min(p1[0], p3[0])) and \
            (p2[1] <= max(p1[1], p3[1])) and (p2[1] >= min(p1[1], p3[1]))):
        return True
    else:
        return False