updraft function
void
updraft(})
An updraft column at x: smoke, dust, fire and embers below top and within w of the axis
are carried up (up px/s^2) and squeezed toward it.
Implementation
void updraft(
Particles ps,
double dt, {
double x = 0.0,
double top = double.negativeInfinity,
double w = 12.0,
double up = 150.0,
double squeeze = 4.0,
double pull = 0.0,
double low = 10.0,
double reach = 100.0,
double k = 1.0,
}) {
if (k <= 0.0) return;
for (final q in ps.list) {
if (q.delay > 0.0 || !_lifts.contains(q.k) || q.y < top) continue;
final dx = q.x - x;
final ax = dx.abs();
final u = ax / w;
if (u < 1.0) {
final f = (1.0 - u * u) * k;
q.vy -= up * f * dt;
q.vx -= dx * squeeze * f * dt;
}
if (pull != 0.0 && q.y > -low && ax > w * 0.4 && ax < reach) {
q.vx -= dx.sign * pull * k * (1.0 - ax / reach) * dt;
}
}
}