From 5cfad05da4dfaba3a737dd3440c384ddf2232110 Mon Sep 17 00:00:00 2001 From: HugoFara Date: Fri, 23 Oct 2026 18:04:13 +0200 Subject: [PATCH] feat(wasm): colour the burn by arrival time and the front by rate of spread The faded perimeter trail is replaced by two layers built from what the engine already reports. Arrival paints the burnt ground by when it caught fire, the arrival-time map ForeFire writes natively, with isochrones at a round interval. Spread colours each segment of the front by its nodes' rate of spread, which the worker now keeps from the `vel` in print[] instead of discarding it. Each frame's fronts become one Path2D in domain metres once per run, so the arrival layer redraws through a transform as the view pans and zooms. --- CHANGELOG.md | 2 + bindings/wasm/README.md | 7 ++ bindings/wasm/index.html | 196 ++++++++++++++++++++++++++++++++------- bindings/wasm/worker.mjs | 27 ++++-- 4 files changed, 188 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7334c65..88bd1c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,8 @@ Merged since v2.5.0, not yet released. back in 2D or on 3D terrain. Explore mode lights a fire where you click; Research mode exposes the model, its tuning factors, the numerics, and the fuel moisture and classes. ([#171]) +- The browser demo colours the burnt area by arrival time, with labelled + isochrones, and the fire front by its rate of spread. ([#171]) ### Fixed diff --git a/bindings/wasm/README.md b/bindings/wasm/README.md index f5b0308..b3661e8 100644 --- a/bindings/wasm/README.md +++ b/bindings/wasm/README.md @@ -86,6 +86,13 @@ The page has two modes over the same map: `Ml` and `e` columns of the fuel table), and the excess-green cut-offs between fuel classes. Each control shows the ForeFire name it sets. +Two layers read the run itself. **Arrival** colours the burnt ground by when +it caught fire, with labelled isochrones at a round interval: the arrival-time +map ForeFire writes natively, rebuilt from the perimeter of every frame. +**Spread** colours the front by each node's rate of spread, the length of the +`vel` that `print[]` reports, scaled to the run's 95th percentile so a few fast +nodes on a tight curve do not wash it out. + The models on offer are the ones that run on this fuel table with only slope and wind: Rothermel, BalbiNov2011Curv, BalbiUnsteady, TroisPourcent and Iso. Balbi2015, Balbi2020 and BalbiNov2011TMdMl also need moisture and temperature diff --git a/bindings/wasm/index.html b/bindings/wasm/index.html index d2bdbda..f2e7369 100644 --- a/bindings/wasm/index.html +++ b/bindings/wasm/index.html @@ -147,17 +147,28 @@ #outcome.show { display: block; } #outcome b { color: var(--flame); } - #legend { + .keys { position: absolute; top: 0.9rem; right: 1rem; + display: flex; + flex-direction: column; + gap: 0.4rem; + width: 10rem; + pointer-events: none; + } + .keys > div { padding: 0.45rem 0.65rem; border-radius: 6px; background: rgba(13, 11, 10, 0.78); font-size: 12px; display: none; } - body.fuel #legend { display: block; } + body.fuel #legend, + body.ran.arrival #arrivalKey, + body.ran.spread #spreadKey { display: block; } + .scale .bar { height: 8px; border-radius: 2px; margin: 0.25rem 0 0.15rem; } + .scale .ends { display: flex; justify-content: space-between; color: var(--dim); font-size: 11px; } #windBadge { position: absolute; left: 1rem; @@ -288,14 +299,24 @@ } - +
ForeFirewildfire spread, running in this tab
-
+
+
+
+ Arrival
+
0
+
+
+ Spread
+
0
+
+

View

- + +