in packages/charts/src/utils/d3-delaunay/index.ts [1074:1117]
_clipFinite(i, points) {
const n = points.length;
let P = null;
let x0,
y0,
x1 = points[n - 2],
y1 = points[n - 1];
let c0,
c1 = this._regioncode(x1, y1);
let e0, e1;
for (let j = 0; j < n; j += 2) {
(x0 = x1), (y0 = y1), (x1 = points[j]), (y1 = points[j + 1]);
(c0 = c1), (c1 = this._regioncode(x1, y1));
if (c0 === 0 && c1 === 0) {
(e0 = e1), (e1 = 0);
if (P) P.push(x1, y1);
else P = [x1, y1];
} else {
let S, sx0, sy0, sx1, sy1;
if (c0 === 0) {
if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue;
[sx0, sy0, sx1, sy1] = S;
} else {
if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue;
[sx1, sy1, sx0, sy0] = S;
(e0 = e1), (e1 = this._edgecode(sx0, sy0));
if (e0 && e1) this._edge(i, e0, e1, P, P.length);
if (P) P.push(sx0, sy0);
else P = [sx0, sy0];
}
(e0 = e1), (e1 = this._edgecode(sx1, sy1));
if (e0 && e1) this._edge(i, e0, e1, P, P.length);
if (P) P.push(sx1, sy1);
else P = [sx1, sy1];
}
}
if (P) {
(e0 = e1), (e1 = this._edgecode(P[0], P[1]));
if (e0 && e1) this._edge(i, e0, e1, P, P.length);
} else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) {
return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin];
}
return P;
}