aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/vec-utils.js
diff options
context:
space:
mode:
authorJonathan Duran2012-04-25 08:15:26 -0700
committerJonathan Duran2012-04-25 08:15:26 -0700
commit4a717f3abdad8f65cf8e61f7308f1f89aa825884 (patch)
treeab3a892eda4853636556ac4e67fa1ecca2f46d1d /js/helper-classes/3D/vec-utils.js
parentef704fcb6b1bb290eb45b6685b073e2932237a68 (diff)
parentd3a6350163ada5644d34ed8d5c2a00cef4db2afc (diff)
downloadninja-4a717f3abdad8f65cf8e61f7308f1f89aa825884.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/helper-classes/3D/vec-utils.js')
-rwxr-xr-xjs/helper-classes/3D/vec-utils.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/helper-classes/3D/vec-utils.js b/js/helper-classes/3D/vec-utils.js
index 4eacd856..0916c840 100755
--- a/js/helper-classes/3D/vec-utils.js
+++ b/js/helper-classes/3D/vec-utils.js
@@ -113,6 +113,25 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
113 } 113 }
114 }, 114 },
115 115
116 vecDistSq : {
117 value: function( dimen, a, b ) {
118 var sum;
119
120 if ((a.length < dimen) || (b.length < dimen))
121 {
122 throw new Error( "dimension error in VecUtils.vecDistSq" );
123 }
124
125 var sum = 0.0;
126 for (var i=0; i<dimen; i++)
127 {
128 var d = a[i] - b[i];
129 sum += d*d;
130 }
131 return sum;
132 }
133 },
134
116 vecDot : { 135 vecDot : {
117 value: function( dimen, v0, v1 ) { 136 value: function( dimen, v0, v1 ) {
118 if ((v0.length < dimen) || (v1.length < dimen)) 137 if ((v0.length < dimen) || (v1.length < dimen))