to find the orientation of an ordered triplet ( p , q , r ) function returns the following values : 0 : Colinear points 1 : Clockwise points 2 : Counterclockwise See https : www . geeksforgeeks . org / orientation - 3 - ordered - points / amp / for details of below formula .
val = ( float ( q . y - p . y ) * ( r . x - q . x ) ) - ( float ( q . x - p . x ) * ( r . y - q . y ) ) NEW_LINE if ( val > 0 ) : NEW_LINE