draw = (context, points, t) => {
mutable nbtotal = points.length;
if (points.length > nbCities) {
points = points.slice();
d3.quickselect(
points,
nbCities,
0,
points.length - 1,
(a, b) => b.size - a.size
);
points.splice(nbCities, points.length - 1)
}
if (background){
context.globalAlpha = 1
context.drawImage(image, 0, 0, width, height)
context.fill()
}
mutable nbrendered = points.length;
context.globalAlpha = 0.5
context.fillStyle = background ? 'yellow' : 'black'
const k = 1 / 500 / t.k;
for (let i = 0; i < points.length; i++) {
const d = points[i],
v = d.size * k;
context.beginPath();
context.arc(
d[0],
d[1],
Math.sqrt(v),
0,
tau
)
context.fill()
}
}