V = {
const V = new Float64Array(w * w).fill(NaN);
const C = new Uint8Array(w * w);
const a = strength / 100;
const ct = Math.cos(transport * radians);
const st = Math.sin(transport * radians);
for (let step = 0; step < 200; step++) {
yield V;
for (let n = 50000; n > 0; n--) {
let x = random();
let y = random();
const i =
Math.floor((0.5 + 0.49 * x) * w) + w * Math.floor((0.5 + 0.49 * y) * w);
if (C[i] > 50) continue;
for (let k = 0; k < 10; ++k) {
const h = Math.hypot(x, y);
const r = 1 - h;
if (r < 0.001) break;
{
const u = random_unit_vector();
const s = r * Math.sqrt(Math.random());
const sx = x + u[0] * s;
const sy = y + u[1] * s;
const h = a / Math.hypot(sx, sy);
x += (sx * ct - sy * st) * h;
y += (sy * ct + sx * st) * h;
}
{
const u = random_unit_vector();
x += r * u[0];
y += r * u[1];
}
}
const c = Math.sin(3 * Math.atan2(y, x));
V[i] = (C[i] ? C[i] * V[i] + c : c) / ++C[i];
}
}
}