diff options
author | Eric Guzman | 2012-04-26 03:16:50 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-26 03:16:50 -0700 |
commit | 110aa15b48ec24063815aa3b86c7f8f041543a02 (patch) | |
tree | d0debb235807dd73f48e0793a73d37cc41ecf59c /js/helper-classes/3D/vec-utils.js | |
parent | 143105a0b9c7765898b22d53489b4bd8df3dff2e (diff) | |
parent | bcc8f8616f5ad4bf310928da6cbc01da12f6e468 (diff) | |
download | ninja-110aa15b48ec24063815aa3b86c7f8f041543a02.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/helper-classes/3D/vec-utils.js')
-rwxr-xr-x | js/helper-classes/3D/vec-utils.js | 19 |
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)) |