Tooling
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user