This commit is contained in:
Rainer Leit
2026-09-25 17:02:24 +03:00
parent cc43ed8dc8
commit 9597629951
2149 changed files with 460234 additions and 1770 deletions
@@ -34,6 +34,12 @@ func Apply(h []float32, w, hgt int, cellM, talus float64, passes int, fixed []bo
if passes <= 0 || talus <= 0 {
return
}
// The scratch is the caller's so a pass inside a loop does not allocate a grid every time; it is optional
// because every other caller of this package passes one and the one that did not spent its first run in a
// panic (slice bounds out of range) rather than in a weather simulation.
if cap(scratch) < len(h) {
scratch = make([]float32, len(h))
}
delta := scratch[:len(h)]
card := cellM
diag := cellM * math.Sqrt2