function orientation(p, q, r) {
  var orientationValue = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);

  if (orientationValue === 0) {
    return 0; // Colinear
  }

  return orientationValue > 0 ? 1 : 2;
}
/**
* Checks the orientation of 3 points.
*
* @param {Object} p - First point.
* @param {Object} q - Second point.
* @param {Object} r - Third point.
* @return {Number} - 0: Colinear, 1: Clockwise, 2: Anticlockwise
*/
Checks the orientation of 3 points.
Checks the orientation of 3 points .
function orientation(p, q, r) {
  var orientationValue = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  if (orientationValue === 0) {
    return 0; 
  }
  return orientationValue > 0 ? 1 : 2;
}
function orientation ( p , q , r ) { var orientationValue = ( q . y - p . y ) * ( r . x - q . x ) - ( q . x - p . x ) * ( r . y - q . y ) ; if ( orientationValue === 0 ) { return 0 ; } return orientationValue > 0 ? 1 : 2 ; }
Checks the orientation of 3 points.
Checks the orientation of 3 points .
// Colinear