code: private static boolean diagonalie(int i, int j, int n, int[] verts, int[] indices) {
          int d0 = (indices[i] & 0x0fffffff) * 4;
          int d1 = (indices[j] & 0x0fffffff) * 4;
  
          // For each edge (k,k+1) of P
          for (int k = 0; k < n; k++) {
              int k1 = next(k, n);
              // Skip edges incident to i or j
              if (!((k == i) || (k1 == i) || (k == j) || (k1 == j))) {
                  int p0 = (indices[k] & 0x0fffffff) * 4;
                  int p1 = (indices[k1] & 0x0fffffff) * 4;
  
                  if (vequal(verts, d0, p0) || vequal(verts, d1, p0) || vequal(verts, d0, p1) || vequal(verts, d1, p1))
                      continue;
  
                  if (intersect(verts, d0, d1, p0, p1))
                      return false;
              }
          }
          return true;
      }
docs: diagonal of P, *ignoring edges incident to v_i and v_j*.