If point p satisfies the equation of line joining p1 and p2
else { val = ( p . second - p1 . second ) * ( p2 . first - p1 . first ) - ( p . first - p1 . first ) * ( p2 . second - p1 . second ) ; if ( val == 0 ) if ( ( p . first <= max ( p1 . first , p2 . first ) && ( p . first >= min ( p1 . first , p2 . first ) ) ) && ( p . second <= max ( p1 . second , p2 . second ) && ( p . second >= min ( p1 . second , p2 . second ) ) ) ) return 1 ; } return 0 ; }