_edge()

in packages/charts/src/utils/d3-delaunay/index.ts [1148:1190]


  _edge(i, e0, e1, P, j) {
    while (e0 !== e1) {
      let x, y;
      switch (e0) {
        case 0b0101:
          e0 = 0b0100;
          continue; // top-left
        case 0b0100:
          (e0 = 0b0110), (x = this.xmax), (y = this.ymin);
          break; // top
        case 0b0110:
          e0 = 0b0010;
          continue; // top-right
        case 0b0010:
          (e0 = 0b1010), (x = this.xmax), (y = this.ymax);
          break; // right
        case 0b1010:
          e0 = 0b1000;
          continue; // bottom-right
        case 0b1000:
          (e0 = 0b1001), (x = this.xmin), (y = this.ymax);
          break; // bottom
        case 0b1001:
          e0 = 0b0001;
          continue; // bottom-left
        case 0b0001:
          (e0 = 0b0101), (x = this.xmin), (y = this.ymin);
          break; // left
      }
      if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) {
        P.splice(j, 0, x, y), (j += 2);
      }
    }
    if (P.length > 4) {
      for (let i = 0; i < P.length; i += 2) {
        const j = (i + 2) % P.length,
          k = (i + 4) % P.length;
        if ((P[i] === P[j] && P[j] === P[k]) || (P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]))
          P.splice(j, 2), (i -= 2);
      }
    }
    return j;
  }