code: function isValidDiagonal (data, a, b) {
    return !intersectsPolygon(data, a, a.i, b.i) &&
      locallyInside(data, a, b) && locallyInside(data, b, a) &&
      middleInside(data, a, a.i, b.i)
  }
docs: check if a diagonal between two polygon nodes is valid (lies in polygon interior)