function points(w, h, N) {
const t = Math.max(w, h);
const P = d3.sort(
poissonDisc2d(w + t / 10, h + t / 10, N * 1.2),
([x, y]) => -Math.min(w - x, h - y)
);
const Q = P.slice(0, N);
const M = d3.min(Q, ([x, y]) => Math.min(w - x, h - y));
const ratio = t / (t - M);
for (const d of P) {
d[0] *= ratio;
d[1] *= ratio;
}
const x = d3.extent(Q, (d) => d[0]);
const y = d3.extent(Q, (d) => d[1]);
const tx = (w - x[1] - x[0]) / 2;
const ty = (h - y[1] - y[0]) / 2;
P.forEach((d) => {
d[0] += tx;
d[1] += ty;
});
return P;
}