def intersect2D(segment, point):
    """
    Calculates if a ray of x->inf from "point" intersects with the segment
    segment = [(x1, y1), (x2, y2)]
    """
    x, y = point
    
    #print(segment)
    x1, y1 = segment[0]
    x2, y2 = segment[1]
    if (y1<=y and y<y2) or (y2<=y and y<y1):
        x3 = x2*(y1-y)/(y1-y2) + x1*(y-y2)/(y1-y2)
        if x3 >= x:
            return True
        else: return False
    else: return False