UNPKG

cacatoo

Version:

Building, exploring, and sharing spatially structured models

1,498 lines (332 loc) 15.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JsDoc: Global: utility</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <script src="scripts/jquery.js"></script> <script> $(function(){ $("#Navigator").load("navigator.html"); }); </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Utility functions (global)</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="default_colours"><span class="type-signature"></span>default_colours<span class="type-signature"></span></h4> <div class="description"> A list of default colours if nothing is given by the user. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1213">line 1213</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="CopyGridODEs"><span class="type-signature"></span>CopyGridODEs<span class="signature">(cols, rows, template)</span><span class="type-signature"></span></h4> <div class="description"> Make a back-up of all the ODE states (for synchronous ODE updating) </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cols</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">Width of the grid</td> </tr> <tr> <td class="name"><code>rows</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">Height of the grid</td> </tr> <tr> <td class="name"><code>template</code></td> <td class="type"> <span class="param-type">2DArray</span> </td> <td class="description last">Get ODE states from here</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1084">line 1084</a> </li></ul></dd> </dl> <h4 class="name" id="dict_reverse"><span class="type-signature"></span>dict_reverse<span class="signature">(obj)</span><span class="type-signature"></span></h4> <div class="description"> Reverse dictionary </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>obj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">dictionary-style object to reverse in order</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1110">line 1110</a> </li></ul></dd> </dl> <h4 class="name" id="hexToRGB"><span class="type-signature"></span>hexToRGB<span class="signature">(hex)</span><span class="type-signature"></span></h4> <div class="description"> Convert hexadecimal to RGB </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>hex</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">string to convert to RGB</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1147">line 1147</a> </li></ul></dd> </dl> <h4 class="name" id="MakeGrid"><span class="type-signature"></span>MakeGrid<span class="signature">(cols, rows, template)</span><span class="type-signature"></span></h4> <div class="description"> Make a grid, or when a template is given, a COPY of a grid. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cols</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">Width of the new grid</td> </tr> <tr> <td class="name"><code>rows</code></td> <td class="type"> <span class="param-type">int</span> </td> <td class="description last">Height of the new grid</td> </tr> <tr> <td class="name"><code>template</code></td> <td class="type"> <span class="param-type">2DArray</span> </td> <td class="description last">Template to be used for copying (if not set, a new empty grid is made)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1062">line 1062</a> </li></ul></dd> </dl> <h4 class="name" id="nameToRGB"><span class="type-signature"></span>nameToRGB<span class="signature">(name)</span><span class="type-signature"></span></h4> <div class="description"> Convert colour name to RGB </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">string to look up in the set of known colours (see below)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1157">line 1157</a> </li></ul></dd> </dl> <h4 class="name" id="parseColours"><span class="type-signature"></span>parseColours<span class="signature">(cols)</span><span class="type-signature"></span></h4> <div class="description"> Make sure all colours, even when of different types, are stored in the same format (RGB, as cacatoo uses internally) </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cols</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">array of strings, or [R,G,B]-arrays. Only strings are converted, other returned.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1193">line 1193</a> </li></ul></dd> </dl> <h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Below are a few global functions that are used by Simulation classes, but not a method of a Simulation instance per se </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1796">line 1796</a> </li></ul></dd> </dl> <h4 class="name" id="shuffle"><span class="type-signature"></span>shuffle<span class="signature">(array, rng)</span><span class="type-signature"></span></h4> <div class="description"> Randomly shuffle an array with custom RNG </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>array</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">array to be shuffled</td> </tr> <tr> <td class="name"><code>rng</code></td> <td class="type"> <span class="param-type">MersenneTwister</span> </td> <td class="description last">MersenneTwister RNG</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1124">line 1124</a> </li></ul></dd> </dl> <h4 class="name" id="stringToRGB$1"><span class="type-signature"></span>stringToRGB$1<span class="signature">(string)</span><span class="type-signature"></span></h4> <div class="description"> Convert colour string to RGB. Works for colour names ('red','blue' or other colours defined in cacatoo), but also for hexadecimal strings </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>string</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">string to convert to RGB</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="cacatoo.js.html">cacatoo.js</a>, <a href="cacatoo.js.html#line1137">line 1137</a> </li></ul></dd> </dl> </article> </section> </div> <div id="Navigator"></div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Wed Jul 28 2021 15:33:33 GMT+0200 (Central European Summer Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>