aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/vec-utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/3D/vec-utils.js')
-rwxr-xr-xjs/helper-classes/3D/vec-utils.js146
1 files changed, 73 insertions, 73 deletions
diff --git a/js/helper-classes/3D/vec-utils.js b/js/helper-classes/3D/vec-utils.js
index 79b9f965..4575c3d7 100755
--- a/js/helper-classes/3D/vec-utils.js
+++ b/js/helper-classes/3D/vec-utils.js
@@ -82,7 +82,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
82 } 82 }
83 }, 83 },
84 84
85 vecAdd: { 85 vecAdd: {
86 value: function( dimen, a, b ) { 86 value: function( dimen, a, b ) {
87 87
88 var rtnVec; 88 var rtnVec;
@@ -100,7 +100,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
100 }, 100 },
101 101
102 102
103 vecSubtract : { 103 vecSubtract : {
104 value: function( dimen, a, b ) { 104 value: function( dimen, a, b ) {
105 var rtnVec; 105 var rtnVec;
106 if ((a.length < dimen) || (b.length < dimen)) 106 if ((a.length < dimen) || (b.length < dimen))
@@ -116,7 +116,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
116 } 116 }
117 }, 117 },
118 118
119 vecDist : { 119 vecDist : {
120 value: function( dimen, a, b ) { 120 value: function( dimen, a, b ) {
121 var sum; 121 var sum;
122 122
@@ -194,7 +194,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
194 }, 194 },
195 195
196 196
197 vecInterpolate: { 197 vecInterpolate: {
198 value: function( dimen, a, b, t ) { 198 value: function( dimen, a, b, t ) {
199 if ((a.length < dimen) || (b.length < dimen)) 199 if ((a.length < dimen) || (b.length < dimen))
200 { 200 {
@@ -209,7 +209,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
209 } 209 }
210 }, 210 },
211 211
212 vecMag: { 212 vecMag: {
213 value: function( dimen, vec ) { 213 value: function( dimen, vec ) {
214 var sum = 0.0; 214 var sum = 0.0;
215 for (var i=0; i<dimen; i++) 215 for (var i=0; i<dimen; i++)
@@ -227,7 +227,7 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
227 } 227 }
228 }, 228 },
229 229
230 vecScale: { 230 vecScale: {
231 value: function(dimen, vec, scale) { 231 value: function(dimen, vec, scale) {
232 for (var i=0; i<dimen; i++) 232 for (var i=0; i<dimen; i++)
233 vec[i] *= scale; 233 vec[i] *= scale;
@@ -236,72 +236,72 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype,
236 } 236 }
237 }, 237 },
238 238
239 matI : 239 matI :
240 { 240 {
241 value: function(dimen) 241 value: function(dimen)
242 { 242 {
243 var mat = []; 243 var mat = [];
244 for (var i=0; i<dimen*dimen; i++) mat.push(0); 244 for (var i=0; i<dimen*dimen; i++) mat.push(0);
245 245
246 var index = 0; 246 var index = 0;
247 for (var i=0; i<dimen; i++) 247 for (var i=0; i<dimen; i++)
248 { 248 {
249 mat[index] = 1.0; 249 mat[index] = 1.0;
250 index += dimen + 1; 250 index += dimen + 1;
251 } 251 }
252 252
253 return mat; 253 return mat;
254 } 254 }
255 }, 255 },
256 256
257 matTranslation: 257 matTranslation:
258 { 258 {
259 value: function (vec) 259 value: function (vec)
260 { 260 {
261 var mat = Matrix.I(4); 261 var mat = Matrix.I(4);
262 glmat4.translate(mat, vec); 262 glmat4.translate(mat, vec);
263 return mat; 263 return mat;
264 } 264 }
265 }, 265 },
266 266
267 matRotationX: 267 matRotationX:
268 { 268 {
269 value: function( angle ) 269 value: function( angle )
270 { 270 {
271 var mat = Matrix.I(4); 271 var mat = Matrix.I(4);
272 glmat4.rotateX(mat, angle); 272 glmat4.rotateX(mat, angle);
273 return mat; 273 return mat;
274 } 274 }
275 }, 275 },
276 276
277 matRotationY: 277 matRotationY:
278 { 278 {
279 value: function( angle ) 279 value: function( angle )
280 { 280 {
281 var mat = Matrix.I(4); 281 var mat = Matrix.I(4);
282 glmat4.rotateY(mat, angle); 282 glmat4.rotateY(mat, angle);
283 return mat; 283 return mat;
284 } 284 }
285 }, 285 },
286 286
287 matRotationZ: 287 matRotationZ:
288 { 288 {
289 value: function( angle ) 289 value: function( angle )
290 { 290 {
291 var mat = Matrix.I(4); 291 var mat = Matrix.I(4);
292 glmat4.rotateZ(mat, angle); 292 glmat4.rotateZ(mat, angle);
293 return mat; 293 return mat;
294 } 294 }
295 }, 295 },
296 296
297 matRotation: 297 matRotation:
298 { 298 {
299 value: function(angle, axis) 299 value: function(angle, axis)
300 { 300 {
301 var mat = Matrix.I(4); 301 var mat = Matrix.I(4);
302 glmat4.rotate(mat, angle, axis); 302 glmat4.rotate(mat, angle, axis);
303 return mat; 303 return mat;
304 } 304 }
305 } 305 }
306 306
307}); 307});