def _isLeft(P0, P1, P2):
    """
    Test if point P2 is Left|On|Right of the line P0 to P1.
    returns: >0 for left, 0 for on, and <0 for right of the line.
    """
    return (P1.x - P0.x)*(P2.y - P0.y) - (P2.x - P0.x)*(P1.y -  P0.y)