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

Function erosionRate

terrain.js:370–382  ·  view source on GitHub ↗
(h)

Source from the content-addressed store, hash-verified

368}
369
370function erosionRate(h) {
371 var flux = getFlux(h);
372 var slope = getSlope(h);
373 var newh = zero(h.mesh);
374 for (var i = 0; i < h.length; i++) {
375 var river = Math.sqrt(flux[i]) * slope[i];
376 var creep = slope[i] * slope[i];
377 var total = 1000 * river + creep;
378 total = total > 200 ? 200 : total;
379 newh[i] = total;
380 }
381 return newh;
382}
383
384function erode(h, amount) {
385 var er = erosionRate(h);

Callers 1

erodeFunction · 0.85

Calls 3

getFluxFunction · 0.85
getSlopeFunction · 0.85
zeroFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…