UNPKG

cacatoo

Version:

Building, exploring, and sharing spatially structured models

1,900 lines (407 loc) 19.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </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">Global</h1> <section> <header> <h2></h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <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#line1443">line 1443</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#line1424">line 1424</a> </li></ul></dd> </dl> <h4 class="name" id="copy"><span class="type-signature"></span>copy<span class="signature">(aObject)</span><span class="type-signature"></span></h4> <div class="description"> Deep copy function. </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>aObject</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Object to be deep copied. This function still won't deep copy every possible object, so when enabling deep copying, make sure you put your debug-hat on!</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#line332">line 332</a> </li></ul></dd> </dl> <h4 class="name" id="default_colours"><span class="type-signature"></span>default_colours<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Compile a dict of default colours if nothing is given by the user. Reuses colours if more colours are needed. </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#line282">line 282</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#line176">line 176</a> </li></ul></dd> </dl> <h4 class="name" id="get2DFromCanvas"><span class="type-signature"></span>get2DFromCanvas<span class="signature">(canvas)</span><span class="type-signature"> &rarr; {2DArray}</span></h4> <div class="description"> Reconstruct a 2D array based on a canvas </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>canvas</code></td> <td class="type"> <span class="param-type">canvas</span> </td> <td class="description last">HTML canvas element to convert to a 2D grid for Cacatoo</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#line4548">line 4548</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Returns a 2D array (i.e. a grid) with the states </div> <dl> <dt> Type </dt> <dd> <span class="param-type">2DArray</span> </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#line213">line 213</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#line230">line 230</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#line266">line 266</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#line4541">line 4541</a> </li></ul></dd> </dl> <h4 class="name" id="random_colours"><span class="type-signature"></span>random_colours<span class="signature">()</span><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#line317">line 317</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#line190">line 190</a> </li></ul></dd> </dl> <h4 class="name" id="stringToRGB"><span class="type-signature"></span>stringToRGB<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#line204">line 204</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Canvas.html">Canvas</a></li><li><a href="Flockmodel.html">Flockmodel</a></li><li><a href="Graph.html">Graph</a></li><li><a href="Gridmodel.html">Gridmodel</a></li><li><a href="Gridpoint.html">Gridpoint</a></li><li><a href="ODE.html">ODE</a></li><li><a href="QuadTree.html">QuadTree</a></li><li><a href="Simulation.html">Simulation</a></li></ul><h3>Global</h3><ul><li><a href="global.html#CopyGridODEs">CopyGridODEs</a></li><li><a href="global.html#MakeGrid">MakeGrid</a></li><li><a href="global.html#copy">copy</a></li><li><a href="global.html#default_colours">default_colours</a></li><li><a href="global.html#dict_reverse">dict_reverse</a></li><li><a href="global.html#get2DFromCanvas">get2DFromCanvas</a></li><li><a href="global.html#hexToRGB">hexToRGB</a></li><li><a href="global.html#nameToRGB">nameToRGB</a></li><li><a href="global.html#parseColours">parseColours</a></li><li><a href="global.html#pause">pause</a></li><li><a href="global.html#random_colours">random_colours</a></li><li><a href="global.html#shuffle">shuffle</a></li><li><a href="global.html#stringToRGB">stringToRGB</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a> on Wed Dec 18 2024 17:10:07 GMT+0100 (Central European Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>