dome function

void dome(
  1. Painter p,
  2. List<int> f,
  3. double x,
  4. double r,
  5. double k,
)

A hemisphere of white-hot air on the floor at x, radius r.

Implementation

void dome(Painter p, List<int> f, double x, double r, double k) {
  final e = 1.4 / r;
  p.shade(x - r - 1.5, -r - 1.5, x + r + 1.5, 0.5, (px, py, out) {
    final d = hypot(px - x, py) / r;
    if (d > 1.0 + e) return null;
    if (d > 1.0) return f[2];
    if (d > 0.8) return k > 0.45 ? f[6] : f[5];
    if (d > 0.5) return k > 0.45 ? kWhite : f[6];
    return k > 0.2 ? kWhite : f[6];
  });
}