If point p satisfies the equation of line joining p1 and p2
else : NEW_LINE INDENT val = ( ( p [ 1 ] - p1 [ 1 ] ) * ( p2 [ 0 ] - p1 [ 0 ] ) - ( p [ 0 ] - p1 [ 0 ] ) * ( p2 [ 1 ] - p1 [ 1 ] ) ) NEW_LINE if ( val == 0 ) : NEW_LINE INDENT if ( ( p [ 0 ] <= max ( p1 [ 0 ] , p2 [ 0 ] ) and ( p [ 0 ] >= min ( p1 [ 0 ] , p2 [ 0 ] ) ) ) and ( p [ 1 ] <= max ( p1 [ 1 ] , p2 [ 1 ] ) and ( p [ 1 ] >= min ( p1 [ 1 ] , p2 [ 1 ] ) ) ) ) : NEW_LINE INDENT return 1 NEW_LINE DEDENT DEDENT DEDENT return 0 NEW_LINE