mw-engine/docs/codox/mw-engine.drainage.html

22 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>mw-engine.drainage documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Mw-engine</span> <span class="project-version">0.2.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to mw-engine</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mw-engine</span></div></div></li><li class="depth-2 branch"><a href="mw-engine.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.display.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>display</span></div></a></li><li class="depth-2 branch current"><a href="mw-engine.drainage.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>drainage</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.flow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>flow</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.heightmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>heightmap</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.natural-rules.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>natural-rules</span></div></a></li><li class="depth-2 branch"><a href="mw-engine.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="mw-engine.world.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>world</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="mw-engine.drainage.html#var-*sealevel*"><div class="inner"><span>*sealevel*</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-explore-lake"><div class="inner"><span>explore-lake</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-find-lakes"><div class="inner"><span>find-lakes</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flood-hollow"><div class="inner"><span>flood-hollow</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flood-hollows"><div class="inner"><span>flood-hollows</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flow"><div class="inner"><span>flow</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flow-contributors"><div class="inner"><span>flow-contributors</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flow-nr"><div class="inner"><span>flow-nr</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flow-world"><div class="inner"><span>flow-world</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-flow-world-nr"><div class="inner"><span>flow-world-nr</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-is-hollow"><div class="inner"><span>is-hollow</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-is-lake.3F"><div class="inner"><span>is-lake?</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-max-altitude"><div class="inner"><span>max-altitude</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-rain-row"><div class="inner"><span>rain-row</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-rain-world"><div class="inner"><span>rain-world</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-rainfall"><div class="inner"><span>rainfall</span></div></a></li><li class="depth-1"><a href="mw-engine.drainage.html#var-run-drainage"><div class="inner"><span>run-drainage</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">mw-engine.drainage</h1><div class="doc"><div class="markdown"><p>Experimental, probably of no interest to anyone else; attempt to compute drainage on a world, assumed to have altitudes already set from a heightmap.</p>
</div></div><div class="public anchor" id="var-*sealevel*"><h3>*sealevel*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L36">view source</a></div></div><div class="public anchor" id="var-explore-lake"><h3>explore-lake</h3><div class="usage"><code>(explore-lake _world _cell)</code></div><div class="doc"><div class="markdown"><p>Return a sequence of cells starting with this <code>cell</code> in this <code>world</code> which form a contiguous lake</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L189">view source</a></div></div><div class="public anchor" id="var-find-lakes"><h3>find-lakes</h3><div class="usage"><code>(find-lakes _world)</code></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L209">view source</a></div></div><div class="public anchor" id="var-flood-hollow"><h3>flood-hollow</h3><div class="usage"><code>(flood-hollow _world cell neighbours)</code><code>(flood-hollow world cell)</code></div><div class="doc"><div class="markdown"><p>Raise the altitude of a copy of this <code>cell</code> of this <code>world</code> to the altitude of the lowest of its <code>neighbours</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L122">view source</a></div></div><div class="public anchor" id="var-flood-hollows"><h3>flood-hollows</h3><div class="usage"><code>(flood-hollows world)</code></div><div class="doc"><div class="markdown"><p>Flood all local hollows in this <code>world</code>. At this stage only floods single cell hollows.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L132">view source</a></div></div><div class="public anchor" id="var-flow"><h3>flow</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>Compute the total flow upstream of this <code>cell</code> in this <code>world</code>, and return a cell identical to this one but having a value of its flow property set from that computation. The function is memoised because the consequence of mapping a recursive function across an array is that many cells will be revisited - potentially many times.</p>
<p>Flow comes from a higher cell to a lower only if the lower is the lowest neighbour of the higher.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L158">view source</a></div></div><div class="public anchor" id="var-flow-contributors"><h3>flow-contributors</h3><div class="usage"><code>(flow-contributors cell world)</code></div><div class="doc"><div class="markdown"><p>Return a list of the cells in this <code>world</code> which are higher than this <code>cell</code> and for which this cell is the lowest neighbour, or which are at the same altitude and have greater flow</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L91">view source</a></div></div><div class="public anchor" id="var-flow-nr"><h3>flow-nr</h3><div class="usage"><code>(flow-nr cell world)</code></div><div class="doc"><div class="markdown"><p>Experimental non recursive flow algorithm, needs to be run on a world as many times as there are distinct altitude values. This algorithm works only if applied sequentially from the highest altitude to the lowest, see <code>flow-world-nr</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L142">view source</a></div></div><div class="public anchor" id="var-flow-world"><h3>flow-world</h3><div class="usage"><code>(flow-world world)</code></div><div class="doc"><div class="markdown"><p>Return a world like this <code>world</code>, but with cells tagged with the amount of water flowing through them.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L183">view source</a></div></div><div class="public anchor" id="var-flow-world-nr"><h3>flow-world-nr</h3><div class="usage"><code>(flow-world-nr world)</code></div><div class="doc"><div class="markdown"><p>Experimental non-recursive flow-world algorithm</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L178">view source</a></div></div><div class="public anchor" id="var-is-hollow"><h3>is-hollow</h3><div class="usage"><code>(is-hollow world cell)</code></div><div class="doc"><div class="markdown"><p>Detects point hollows - that is, individual cells all of whose neighbours are higher. Return true if this <code>cell</code> has an altitude lower than any of its neighbours in this <code>world</code></p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L108">view source</a></div></div><div class="public anchor" id="var-is-lake.3F"><h3>is-lake?</h3><div class="usage"><code>(is-lake? world cell)</code></div><div class="doc"><div class="markdown"><p>If this <code>cell</code> in this <code>world</code> is not part of a lake, return nil. If it is, return a cell like this <code>cell</code> tagged as part of a lake.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L195">view source</a></div></div><div class="public anchor" id="var-max-altitude"><h3>max-altitude</h3><div class="usage"></div><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L140">view source</a></div></div><div class="public anchor" id="var-rain-row"><h3>rain-row</h3><div class="usage"><code>(rain-row row)</code><code>(rain-row row rain-probability)</code><code>(rain-row row map-width previous-altitude drops-in-cloud)</code></div><div class="doc"><div class="markdown"><p>Return a row like this <code>row</code>, across which rainfall has been distributed; if <code>rain-probability</code> is specified, it is the probable rainfall on a cell with no gradient.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L57">view source</a></div></div><div class="public anchor" id="var-rain-world"><h3>rain-world</h3><div class="usage"><code>(rain-world world)</code></div><div class="doc"><div class="markdown"><p>Simulate rainfall on this <code>world</code>. TODO: Doesnt really work just now - should rain more on west-facing slopes, and less to the east of high ground</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L82">view source</a></div></div><div class="public anchor" id="var-rainfall"><h3>rainfall</h3><div class="usage"><code>(rainfall gradient remaining map-width)</code></div><div class="doc"><div class="markdown"><p>Compute rainfall for a cell with this <code>gradient</code> west-east, given <code>remaining</code> drops to distribute, and this overall map width.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L41">view source</a></div></div><div class="public anchor" id="var-run-drainage"><h3>run-drainage</h3><div class="usage"><code>(run-drainage hmap)</code></div><div class="doc"><div class="markdown"><p>Create a world from the heightmap <code>hmap</code>, rain on it, and then compute river flows.</p>
</div></div><div class="src-link"><a href="https://github.com/simon-brooke/mw-engine/blob/master/src/cljc/mw_engine/drainage.clj#L213">view source</a></div></div></div></body></html>