def _point_line_halfspace(point, v0, v1):
    """
    Check which half-space the point is in relative to line [v0,v1].
    Params: Point, v0, and v1 are all arrays with x and y values.
    Return: A positive or negative value indicates the respective halfspace.
    0 means the point is on the line or the line has zero length.
    """
    v0_to_v1 = [v1[0]-v0[0], v1[1]-v0[1]]
    v0_to_point = [point[0]-v0[0], point[1]-v0[1]]
    normal = [-v0_to_v1[1], v0_to_v1[0]]

    # Take the dot product of the normal and v0_to_point.
    return normal[0]*v0_to_point[0] + normal[1]*v0_to_point[1]