function update_dots(transform, chart)
{
var interp = d3.interpolate('#800','#06f');
var scale = 1 / transform.k;
var size = Math.min(2, 1*transform.k) * scale_preference;
var t0 = performance.now()
let points = census_collection.features.map(geo =>
{
var poly = biggest_map_poly(geo);
var n = amount_of_dots(geo);
var pp = makeDots(poly, n,
{distance: size * scale * 1, edgeDistance: 0.5 * scale, maxIterations: 10*n});
if (pp.length == 0 && n > 0) { pp = [d3.polygonCentroid(poly)]; }
pp.pressure = pp.length / n || 0;
return pp
});
var t1 = performance.now()
console.log("time for calculation is", (t1 - t0)*.001, "success rate",
points.map(p => p.length).reduce((a, b) => a + b, 0) /
census_collection.features.map(amount_of_dots).reduce((a, b) => a + b, 0));
chart.map_layer.select(":first-child")
.attr('stroke', sa_type == 1 ? '#fc9' : '#f95')
.attr('stroke-opacity', 0.3)
.attr('stroke-width', sa_type == 1 ? 0.3 : 0.5)
.attr('stroke-linejoin', 'round');
if (!chart[dot_key])
chart[dot_key] = chart.img_layer.append('g');
chart[dot_key]
.selectAll("g")
.data(points)
.join("g")
.attr('fill', dd => interp(dd.pressure))
.attr('stroke', 0)
.selectAll("circle")
.data(dd => dd)
.join("circle")
.attr("pointer-events", "none")
.attr('cx', d => d[0])
.attr('cy', d => d[1])
.attr('r', size * scale);
var t2 = performance.now()
console.log("time for svg update is", (t2 - t1)*.001);
}