def is_left(p0, p1, p2):
    """
    Tests if a point is on left or right of an infinite line
    input: three points p0, p1, p2
    returns: >0 if p2 is left of line thru p0 and p1
           =0 if p2 is on line
           <0 if p2 is right of the line
    """
    return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y)