UNPKG

bot18

Version:

A high-frequency cryptocurrency trading bot by Zenbot creator @carlos8f

4,908 lines (1,255 loc) 80.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Module: vec2</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">Module: vec2</h1> <section> <header> </header> <article> <div class="container-overview"> <div class="description">2 Dimensional Vector</div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line3">line 3</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".add"><span class="type-signature">(static) </span>add<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Adds two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line82">line 82</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".angle"><span class="type-signature">(static) </span>angle<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Get the angle between two 2D vectors </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line476">line 476</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The angle in radians </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".ceil"><span class="type-signature">(static) </span>ceil<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Math.ceil the components of a vec2 </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to ceil</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line137">line 137</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".clone"><span class="type-signature">(static) </span>clone<span class="signature">(a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Creates a new vec2 initialized with values from an existing vector </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to clone</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line26">line 26</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> a new 2D vector </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".copy"><span class="type-signature">(static) </span>copy<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Copy the values from one vec2 to another </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the source vector</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line54">line 54</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".create"><span class="type-signature">(static) </span>create<span class="signature">()</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Creates a new, empty vec2 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line13">line 13</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> a new 2D vector </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".cross"><span class="type-signature">(static) </span>cross<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec3}</span></h4> <div class="description"> Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector </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>out</code></td> <td class="type"> <span class="param-type">vec3</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line342">line 342</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec3</span> </dd> </dl> <h4 class="name" id=".dist"><span class="type-signature">(static) </span>dist<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Alias for vec2.distance </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line570">line 570</a> </li></ul></dd> </dl> <h4 class="name" id=".distance"><span class="type-signature">(static) </span>distance<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Calculates the euclidian distance between two vec2's </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line233">line 233</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> distance between a and b </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".div"><span class="type-signature">(static) </span>div<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Alias for vec2.divide </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line564">line 564</a> </li></ul></dd> </dl> <h4 class="name" id=".divide"><span class="type-signature">(static) </span>divide<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Divides two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line124">line 124</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".dot"><span class="type-signature">(static) </span>dot<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Calculates the dot product of two vec2's </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line329">line 329</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> dot product of a and b </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".equals"><span class="type-signature">(static) </span>equals<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Returns whether or not the vectors have approximately the same elements in the same position. </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The first vector.</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The second vector.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line535">line 535</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if the vectors are equal, false otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".exactEquals"><span class="type-signature">(static) </span>exactEquals<span class="signature">(a, b)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The first vector.</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">The second vector.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line524">line 524</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if the vectors are equal, false otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".floor"><span class="type-signature">(static) </span>floor<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Math.floor the components of a vec2 </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to floor</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line150">line 150</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".forEach"><span class="type-signature">(static) </span>forEach<span class="signature">(a, stride, offset, count, fn, arg<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Perform some operation over an array of vec2s. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="attributes"> </td> <td class="description last">the array of vectors to iterate over</td> </tr> <tr> <td class="name"><code>stride</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> </td> <td class="description last">Number of elements between the start of each vec2. If 0 assumes tightly packed</td> </tr> <tr> <td class="name"><code>offset</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> </td> <td class="description last">Number of elements to skip at the beginning of the array</td> </tr> <tr> <td class="name"><code>count</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> </td> <td class="description last">Number of vec2s to iterate over. If 0 iterates over entire array</td> </tr> <tr> <td class="name"><code>fn</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last">Function to call for each vector in the array</td> </tr> <tr> <td class="name"><code>arg</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">additional argument to pass to fn</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line596">line 596</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> a </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".fromValues"><span class="type-signature">(static) </span>fromValues<span class="signature">(x, y)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Creates a new vec2 initialized with the given values </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>x</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">X component</td> </tr> <tr> <td class="name"><code>y</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">Y component</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line40">line 40</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> a new 2D vector </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".inverse"><span class="type-signature">(static) </span>inverse<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Returns the inverse of the components of a vec2 </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to invert</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line296">line 296</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".len"><span class="type-signature">(static) </span>len<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Alias for vec2.length </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line546">line 546</a> </li></ul></dd> </dl> <h4 class="name" id=".length"><span class="type-signature">(static) </span>length<span class="signature">(a)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Calculates the length of a vec2 </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>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to calculate length of</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line258">line 258</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> length of a </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".lerp"><span class="type-signature">(static) </span>lerp<span class="signature">(out, a, b, t)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Performs a linear interpolation between two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> <tr> <td class="name"><code>t</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">interpolation amount, in the range [0-1], between the two inputs</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line358">line 358</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".max"><span class="type-signature">(static) </span>max<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Returns the maximum of two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line178">line 178</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".min"><span class="type-signature">(static) </span>min<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Returns the minimum of two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line164">line 164</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".mul"><span class="type-signature">(static) </span>mul<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Alias for vec2.multiply </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line558">line 558</a> </li></ul></dd> </dl> <h4 class="name" id=".multiply"><span class="type-signature">(static) </span>multiply<span class="signature">(out, a, b)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Multiplies two vec2's </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the first operand</td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the second operand</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line110">line 110</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".negate"><span class="type-signature">(static) </span>negate<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Negates the components of a vec2 </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to negate</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line283">line 283</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".normalize"><span class="type-signature">(static) </span>normalize<span class="signature">(out, a)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Normalize a vec2 </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>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">the receiving vector</td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="description last">vector to normalize</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="vec2.js.html">vec2.js</a>, <a href="vec2.js.html#line309">line 309</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> out </div> <dl> <dt> Type </dt> <dd> <span class="param-type">vec2</span> </dd> </dl> <h4 class="name" id=".random"><span class="type-signature">(static) </span>random<span class="signature">(out, scale<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {vec2}</span></h4> <div class="description"> Generates a random vector with the given scale </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>out</code></td> <td class="type"> <span class="param-type">vec2</span> </td> <td class="attributes"> </td>