atum
Version:
A Procedural Graph Based Javascript Library
2,464 lines (998 loc) • 89.8 kB
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class: Vector</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<script src="scripts/jquery.min.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/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/jaguar.css">
<script>
var config = {"monospaceLinks":false,"cleverLinks":false,"default":{"outputSourceFiles":true}};
</script>
</head>
<body>
<div id="wrap" class="clearfix">
<div class="navigation">
<h3 class="applicationName"><a href="index.html"></a></h3>
<div class="search">
<input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations">
</div>
<ul class="list">
<li class="item" data-name="Center">
<span class="title">
<a href="Center.html">Center</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Center#add"><a href="Center.html#add">add</a></li>
<li data-name="Center#cross"><a href="Center.html#cross">cross</a></li>
<li data-name="Center#divide"><a href="Center.html#divide">divide</a></li>
<li data-name="Center#dot"><a href="Center.html#dot">dot</a></li>
<li data-name="Center#key"><a href="Center.html#key">key</a></li>
<li data-name="Center#list"><a href="Center.html#list">list</a></li>
<li data-name="Center#magnitude"><a href="Center.html#magnitude">magnitude</a></li>
<li data-name="Center#multiply"><a href="Center.html#multiply">multiply</a></li>
<li data-name="Center#normalize"><a href="Center.html#normalize">normalize</a></li>
<li data-name="Center#perpendiculars"><a href="Center.html#perpendiculars">perpendiculars</a></li>
<li data-name="Center#rotate"><a href="Center.html#rotate">rotate</a></li>
<li data-name="Center#subtract"><a href="Center.html#subtract">subtract</a></li>
<li data-name="Center#toString"><a href="Center.html#toString">toString</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Corner">
<span class="title">
<a href="Corner.html">Corner</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Corner#add"><a href="Corner.html#add">add</a></li>
<li data-name="Corner#cross"><a href="Corner.html#cross">cross</a></li>
<li data-name="Corner#divide"><a href="Corner.html#divide">divide</a></li>
<li data-name="Corner#dot"><a href="Corner.html#dot">dot</a></li>
<li data-name="Corner#key"><a href="Corner.html#key">key</a></li>
<li data-name="Corner#list"><a href="Corner.html#list">list</a></li>
<li data-name="Corner#magnitude"><a href="Corner.html#magnitude">magnitude</a></li>
<li data-name="Corner#multiply"><a href="Corner.html#multiply">multiply</a></li>
<li data-name="Corner#normalize"><a href="Corner.html#normalize">normalize</a></li>
<li data-name="Corner#perpendiculars"><a href="Corner.html#perpendiculars">perpendiculars</a></li>
<li data-name="Corner#rotate"><a href="Corner.html#rotate">rotate</a></li>
<li data-name="Corner#subtract"><a href="Corner.html#subtract">subtract</a></li>
<li data-name="Corner#toString"><a href="Corner.html#toString">toString</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Diagram">
<span class="title">
<a href="Diagram.html">Diagram</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Edge">
<span class="title">
<a href="Edge.html">Edge</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Line">
<span class="title">
<a href="Line.html">Line</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Map">
<span class="title">
<a href="Map.html">Map</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Map#generate"><a href="Map.html#generate">generate</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="PointDistribution">
<span class="title">
<a href="PointDistribution.html">PointDistribution</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="PointDistribution.exports.circular"><a href="PointDistribution.html#.exports.circular">exports.circular</a></li>
<li data-name="PointDistribution.exports.hexagon"><a href="PointDistribution.html#.exports.hexagon">exports.hexagon</a></li>
<li data-name="PointDistribution.exports.jitteredGrid"><a href="PointDistribution.html#.exports.jitteredGrid">exports.jitteredGrid</a></li>
<li data-name="PointDistribution.exports.poisson"><a href="PointDistribution.html#.exports.poisson">exports.poisson</a></li>
<li data-name="PointDistribution.exports.random"><a href="PointDistribution.html#.exports.random">exports.random</a></li>
<li data-name="PointDistribution.exports.recursiveWang"><a href="PointDistribution.html#.exports.recursiveWang">exports.recursiveWang</a></li>
<li data-name="PointDistribution.exports.square"><a href="PointDistribution.html#.exports.square">exports.square</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Polygon">
<span class="title">
<a href="Polygon.html">Polygon</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Polygon#centroid"><a href="Polygon.html#centroid">centroid</a></li>
<li data-name="Polygon#inset"><a href="Polygon.html#inset">inset</a></li>
<li data-name="Polygon#isConvex"><a href="Polygon.html#isConvex">isConvex</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Rand">
<span class="title">
<a href="Rand.html">Rand</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Rand.rand"><a href="Rand.html#.rand">rand</a></li>
<li data-name="Rand.randHex"><a href="Rand.html#.randHex">randHex</a></li>
<li data-name="Rand.randHexColor"><a href="Rand.html#.randHexColor">randHexColor</a></li>
<li data-name="Rand.randInt"><a href="Rand.html#.randInt">randInt</a></li>
<li data-name="Rand.randRange"><a href="Rand.html#.randRange">randRange</a></li>
<li data-name="Rand.setSeed"><a href="Rand.html#.setSeed">setSeed</a></li>
<li data-name="Rand.vector"><a href="Rand.html#.vector">vector</a></li>
<li data-name="Rand#rand"><a href="Rand.html#rand">rand</a></li>
<li data-name="Rand#randHex"><a href="Rand.html#randHex">randHex</a></li>
<li data-name="Rand#randHexColor"><a href="Rand.html#randHexColor">randHexColor</a></li>
<li data-name="Rand#randInt"><a href="Rand.html#randInt">randInt</a></li>
<li data-name="Rand#randRange"><a href="Rand.html#randRange">randRange</a></li>
<li data-name="Rand#setSeed"><a href="Rand.html#setSeed">setSeed</a></li>
<li data-name="Rand#vector"><a href="Rand.html#vector">vector</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Rectangle">
<span class="title">
<a href="Rectangle.html">Rectangle</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Rectangle#centroid"><a href="Rectangle.html#centroid">centroid</a></li>
<li data-name="Rectangle#inset"><a href="Rectangle.html#inset">inset</a></li>
<li data-name="Rectangle#isConvex"><a href="Rectangle.html#isConvex">isConvex</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Redist">
<span class="title">
<a href="Redist.html">Redist</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Redist.exports.exp"><a href="Redist.html#.exports.exp">exports.exp</a></li>
<li data-name="Redist.exports.identity"><a href="Redist.html#.exports.identity">exports.identity</a></li>
<li data-name="Redist.exports.inverse"><a href="Redist.html#.exports.inverse">exports.inverse</a></li>
<li data-name="Redist.exports.pow"><a href="Redist.html#.exports.pow">exports.pow</a></li>
<li data-name="Redist.exports.step"><a href="Redist.html#.exports.step">exports.step</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Shape">
<span class="title">
<a href="Shape.html">Shape</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Triangle">
<span class="title">
<a href="Triangle.html">Triangle</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Triangle#centroid"><a href="Triangle.html#centroid">centroid</a></li>
<li data-name="Triangle#inset"><a href="Triangle.html#inset">inset</a></li>
<li data-name="Triangle#isConvex"><a href="Triangle.html#isConvex">isConvex</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="Vector">
<span class="title">
<a href="Vector.html">Vector</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
<span class="subtitle">Methods</span>
<li data-name="Vector.add"><a href="Vector.html#.add">add</a></li>
<li data-name="Vector.angle"><a href="Vector.html#.angle">angle</a></li>
<li data-name="Vector.avg"><a href="Vector.html#.avg">avg</a></li>
<li data-name="Vector.copy"><a href="Vector.html#.copy">copy</a></li>
<li data-name="Vector.cross"><a href="Vector.html#.cross">cross</a></li>
<li data-name="Vector.dist2"><a href="Vector.html#.dist2">dist2</a></li>
<li data-name="Vector.distance"><a href="Vector.html#.distance">distance</a></li>
<li data-name="Vector.distToSeg"><a href="Vector.html#.distToSeg">distToSeg</a></li>
<li data-name="Vector.distToSegSquared"><a href="Vector.html#.distToSegSquared">distToSegSquared</a></li>
<li data-name="Vector.dot"><a href="Vector.html#.dot">dot</a></li>
<li data-name="Vector.down"><a href="Vector.html#.down">down</a></li>
<li data-name="Vector.left"><a href="Vector.html#.left">left</a></li>
<li data-name="Vector.midpoint"><a href="Vector.html#.midpoint">midpoint</a></li>
<li data-name="Vector.proj"><a href="Vector.html#.proj">proj</a></li>
<li data-name="Vector.right"><a href="Vector.html#.right">right</a></li>
<li data-name="Vector.subtract"><a href="Vector.html#.subtract">subtract</a></li>
<li data-name="Vector.up"><a href="Vector.html#.up">up</a></li>
<li data-name="Vector.zero"><a href="Vector.html#.zero">zero</a></li>
<li data-name="Vector#add"><a href="Vector.html#add">add</a></li>
<li data-name="Vector#cross"><a href="Vector.html#cross">cross</a></li>
<li data-name="Vector#divide"><a href="Vector.html#divide">divide</a></li>
<li data-name="Vector#dot"><a href="Vector.html#dot">dot</a></li>
<li data-name="Vector#key"><a href="Vector.html#key">key</a></li>
<li data-name="Vector#list"><a href="Vector.html#list">list</a></li>
<li data-name="Vector#magnitude"><a href="Vector.html#magnitude">magnitude</a></li>
<li data-name="Vector#multiply"><a href="Vector.html#multiply">multiply</a></li>
<li data-name="Vector#normalize"><a href="Vector.html#normalize">normalize</a></li>
<li data-name="Vector#perpendiculars"><a href="Vector.html#perpendiculars">perpendiculars</a></li>
<li data-name="Vector#rotate"><a href="Vector.html#rotate">rotate</a></li>
<li data-name="Vector#subtract"><a href="Vector.html#subtract">subtract</a></li>
<li data-name="Vector#toString"><a href="Vector.html#toString">toString</a></li>
<li data-name="Vector#toString"><a href="Vector.html#toString">toString</a></li>
</ul>
<ul class="events itemMembers">
</ul>
</li>
<li class="item" data-name="module:Atum">
<span class="title">
<a href="module-Atum.html">module:Atum</a>
</span>
<ul class="members itemMembers">
</ul>
<ul class="typedefs itemMembers">
</ul>
<ul class="methods itemMembers">
</ul>
<ul class="events itemMembers">
</ul>
</li>
</ul>
</div>
<div class="main">
<h1 class="page-title" data-filename="Vector.html">Class: Vector</h1>
<section>
<header>
<h2>
Vector
</h2>
<div class="class-description">Vector
This is a basic vector class that is used for geometry, position inforamtion,
movement infomation, and more complex structures.
The vector class follows a immutable paradigm where changes are not made to the
vectors themselves. Any change to a vector is returned as a new vector that
must be captured.</div>
</header>
<article>
<div class="container-overview">
<dt>
<div class="nameContainer">
<h4 class="name" id="Vector">
new Vector<span class="signature">(x, <span class="optional">y</span>)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line26">line 26</a>
</div>
</div>
<p class="summary">Create a 2D Vector object</p>
</dt>
<dd>
<div class="description">
This vector class was constructed so that it can mirror two types of common
point/vector type objects. This is having object properties stored as object
properties (eg. vector.x, vector.y) or as list properties, [x, y] which can
be accessed by vector[0], or vector[1].
</div>
<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>
|
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The x component or another vector</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">
<span class="optional">optional</span>
The y component</td>
</tr>
</tbody>
</table>
<dl class="details">
<h5 class="subsection-title">Properties:</h5>
<dl>
<table class="props">
<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">The x vector 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">The y vector component</td>
</tr>
<tr>
<td class="name"><code>0</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The x vector component</td>
</tr>
<tr>
<td class="name"><code>1</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The y vector component</td>
</tr>
</tbody>
</table></dl>
</dl>
</dd>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<div class="nameContainer">
<h4 class="name" id=".add">
<span class="type-signature static">static</span>Vector.add<span class="signature">(a, b)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Vector.html">Vector</a>}</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line114">line 114</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Add two vectors element wise
</div>
<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"><a href="Vector.html">Vector</a></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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Vector.html">Vector</a>
</td>
<td class="description last">The vector result of adding the two vectors</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".angle">
<span class="type-signature static">static</span>Vector.angle<span class="signature">(a, b)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line317">line 317</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the angle between two vectors
</div>
<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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The frist vector</td>
</tr>
<tr>
<td class="name"><code>b</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
The angle between vector a and vector b
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".avg">
<span class="type-signature static">static</span>Vector.avg<span class="signature">(vectors)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line232">line 232</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the average location between several vectors
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>vectors</code></td>
<td class="type">
<span class="param-type">Array.<<a href="Vector.html">Vector</a>></span>
</td>
<td class="description last">
The list of vectors to average</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".copy">
<span class="type-signature static">static</span>Vector.copy<span class="signature">(v)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Vector.html">Vector</a>}</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line89">line 89</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get a copy of the input vector
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
the vector to be coppied</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
<a href="Vector.html">Vector</a>
</td>
<td class="description last">The vector copy</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".cross">
<span class="type-signature static">static</span>Vector.cross<span class="signature">(a, b)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{number}</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line261">line 261</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the cross product of two vectors
</div>
<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"><a href="Vector.html">Vector</a></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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
number
</td>
<td class="description last">The cross product of the two vectors</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".dist2">
<span class="type-signature static">static</span>Vector.dist2<span class="signature">(a, b)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line347">line 347</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the euclidean distnace squared between two vectors.
This is used as a helper for the distnace function but can be used
to save on speed by not doing the square root operation.
</div>
<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"><a href="Vector.html">Vector</a></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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>distnace</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
The euclidean distance squared between vector a and vector b
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".distance">
<span class="type-signature static">static</span>Vector.distance<span class="signature">(a, b)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line331">line 331</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the euclidean distance between two vectors
</div>
<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"><a href="Vector.html">Vector</a></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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>dist2</li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
The euclidean distance between a and b
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".distToSeg">
<span class="type-signature static">static</span>Vector.distToSeg<span class="signature">(p, v, w)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line366">line 366</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the shortest distance between the point p and the line
segment v to w.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>p</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The vector point</td>
</tr>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The first line segment endpoint</td>
</tr>
<tr>
<td class="name"><code>w</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second line segment endpoint</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>distToSeg2</li>
<li><a target="_blank" href="http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment">http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
The shortest euclidean distance between point
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".distToSegSquared">
<span class="type-signature static">static</span>Vector.distToSegSquared<span class="signature">(p, v, w)</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line383">line 383</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the shortest distance squared between the point p and the line
segment v to w.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>p</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The vector point</td>
</tr>
<tr>
<td class="name"><code>v</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The first line segment endpoint</td>
</tr>
<tr>
<td class="name"><code>w</code></td>
<td class="type">
<span class="param-type"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second line segment endpoint</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>distToSeg</li>
<li><a target="_blank" href="http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment">http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
The shortest euclidean distance squared between point
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".dot">
<span class="type-signature static">static</span>Vector.dot<span class="signature">(a, b)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{number}</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line222">line 222</a>
</div>
</div>
</dt>
<dd>
<div class="description">
Get the dot product of two vectors
</div>
<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"><a href="Vector.html">Vector</a></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"><a href="Vector.html">Vector</a></span>
</td>
<td class="description last">
The second vector</td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
<h5>Returns:</h5>
<table class="params">
<thead>
<tr>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="type">
number
</td>
<td class="description last">The dot product of the two vectors</td>
</tr>
</tbody>
</table>
</dd>
<dt>
<div class="nameContainer">
<h4 class="name" id=".down">
<span class="type-signature static">static</span>Vector.down<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Vector.html">Vector</a>}</span>
</h4>
<div class="tag-source">
<a href="geometry_Vector.js.html">geometry/Vector.js</a>, <a href="geometry_Vector.js.html#line443">line 443</a>
</div>
</div>
</dt>
<dd>
<div class="description