function doesIntersectOtherLines(dataHandles, p1, q1, ignoredHandleIds) {
  var j = dataHandles.length - 1;

  for (var i = 0; i < dataHandles.length; i++) {

    if (ignoredHandleIds.indexOf(i) !== -1 || ignoredHandleIds.indexOf(j) !== -1) {
      j = i;
      continue;
    }

    var p2 = getCoords(dataHandles[j]);
    var q2 = getCoords(dataHandles[i]);

    if (doesIntersect(p1, q1, p2, q2)) {
      return true;
    }

    j = i;
  }

  return false;
}
/**
* Checks whether the line (p1,q1) intersects any of the other lines in the polygon.
*
* @param {Object} dataHandles - data object associated with the tool.
* @param {Object} p1 - Coordinates of the start of the line.
* @param {Object} q1 - Coordinates of the end of the line.
* @param {Object} ignoredHandleIds - Ids of handles to ignore (i.e. lines that share a vertex with the line being tested).
* @return {Boolean} - Whether the line intersects any of the other lines in the polygon.
*/
Checks whether the line (p1,q1) intersects any of the other lines in the polygon.
Checks whether the line ( p1 q1 ) intersects any of the other lines in the polygon .
function doesIntersectOtherLines(dataHandles, p1, q1, ignoredHandleIds) {
  var j = dataHandles.length - 1;
  for (var i = 0; i < dataHandles.length; i++) {
    if (ignoredHandleIds.indexOf(i) !== -1 || ignoredHandleIds.indexOf(j) !== -1) {
      j = i;
      continue;
    }
    var p2 = getCoords(dataHandles[j]);
    var q2 = getCoords(dataHandles[i]);
    if (doesIntersect(p1, q1, p2, q2)) {
      return true;
    }
    j = i;
  }
  return false;
}
function doesIntersectOtherLines ( dataHandles , p1 , q1 , ignoredHandleIds ) { var j = dataHandles . length - 1 ; for ( var i = 0 ; i < dataHandles . length ; i ++ ) { if ( ignoredHandleIds . indexOf ( i ) !== - 1 || ignoredHandleIds . indexOf ( j ) !== - 1 ) { j = i ; continue ; } var p2 = getCoords ( dataHandles [ j ] ) ; var q2 = getCoords ( dataHandles [ i ] ) ; if ( doesIntersect ( p1 , q1 , p2 , q2 ) ) { return true ; } j = i ; } return false ; }
Checks whether the line (p1,q1) intersects any of the other lines in the polygon.
Checks whether the line ( p1 q1 ) intersects any of the other lines in the polygon .