def geoPointSeqSide(p, seg):
    """
    determine on which side of a segment a given point lies

    http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/
    
    Given a line segment between P0 (x0,y0) and P1 (x1,y1), another point P (x,y) has the following relationship to the line segment. 

    Compute 
     (y - y0) (x1 - x0) - (x - x0) (y1 - y0)

    if it is less than 0 then P is to the right of the line segment, if greater than 0 it is to the left, if equal to 0 then it lies on the line segment.
    """
    y,x = p
    (y0,x0),(y1,x1) = seg

    return (y - y0)*(x1 - x0) - (x - x0)*(y1 - y0)