#NEWLINE# def is_left( p0 , p1 , p2 ) : #NEWLINE# #INDENT# 'Test if p2 is left, on or right of the (infinite) line (p0,p1).\n    \n    :return: > 0 for p2 left of the line through p0 and p1\n        = 0 for p2 on the line\n        < 0 for p2 right of the line\n    ' #NEWLINE# sorting = ( ( ( p1 [ X ] - p0 [ X ] ) * ( p2 [ Y ] - p0 [ Y ] ) ) - ( ( p2 [ X ] - p0 [ X ] ) * ( p1 [ Y ] - p0 [ Y ] ) ) ) #NEWLINE# if ( sorting > 0 ) : #NEWLINE# #INDENT# return 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sorting < 0 ) : #NEWLINE# #INDENT# return ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return 0