toeplitz = {
let min = 0;
let solution = [];
let candidates = [];
let steps = 0;
let k;
for (let i = 0; i < points.length; i++) {
for (let j = 0; j < i; j++) {
k = (i * (i + 1) + (j + 1)) / 2;
const a = points[i];
const b = points[j];
const dist2 = (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2;
if (dist2 <= min) continue;
const m = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];
const n = [(b[1] - a[1]) / 2, (a[0] - b[0]) / 2];
const c = [m[0] - n[0], m[1] - n[1]];
const d = [m[0] + n[0], m[1] + n[1]];
if (steps++ % 100000 === 0)
yield {
test: [a, c, b, d],
solution,
candidates,
dist: Math.sqrt(min),
k
};
const t = testSquare(a, c, b, d);
if (t) {
min = dist2;
candidates.push((solution = t));
yield { test: t, solution: t, candidates, dist: Math.sqrt(min), k };
}
}
}
yield { test: [], solution, candidates, dist: Math.sqrt(min) };
}