MCPcopy
hub / github.com/mewo2/terrain / erode

Function erode

terrain.js:384–392  ·  view source on GitHub ↗
(h, amount)

Source from the content-addressed store, hash-verified

382}
383
384function erode(h, amount) {
385 var er = erosionRate(h);
386 var newh = zero(h.mesh);
387 var maxr = d3.max(er);
388 for (var i = 0; i < h.length; i++) {
389 newh[i] = h[i] - amount * (er[i] / maxr);
390 }
391 return newh;
392}
393
394function doErosion(h, amount, n) {
395 n = n || 1;

Callers 1

doErosionFunction · 0.85

Calls 2

erosionRateFunction · 0.85
zeroFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…