1
0
forked from 0ad/0ad

Added a squared vector function for A^2 + B^2 without the rooting, in case massively large nos of vector calculations are needed.

This was SVN commit r10528.
This commit is contained in:
James Baillie 2011-11-13 15:56:37 +00:00
parent 3a678a0c7c
commit 97d3f1cfc9

View File

@ -5,6 +5,13 @@ function VectorDistance(a, b)
return Math.sqrt(dx*dx + dz*dz);
}
function SquareVectorDistance(a, b)//A sqrtless vector calculator, to see if that improves speed at all.
{
var dx = a[0] - b[0];
var dz = a[1] - b[1];
return (dx*dx + dz*dz);
}
function MemoizeInit(obj)
{
obj._memoizeCache = {};