aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorPushkar Joshi2012-03-06 17:05:05 -0800
committerPushkar Joshi2012-03-06 17:05:05 -0800
commit794abd077a0cd4c797d3f566281deca77b184bfe (patch)
tree3bf4a83ca714def2671fe8cef93db859b0d5553f /js/helper-classes
parentc155cd238b6f9e0b8191e0fc533f7bc974b762c2 (diff)
parent2e3943a8f751ec572066f168b58464c24b9f29e5 (diff)
downloadninja-794abd077a0cd4c797d3f566281deca77b184bfe.tar.gz
Merge branch 'master' into pentool
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/Rectangle.js2
-rwxr-xr-xjs/helper-classes/3D/StageLine.js8
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js2
-rwxr-xr-xjs/helper-classes/3D/element-planes.js2
-rwxr-xr-xjs/helper-classes/3D/math-utils.js54
-rwxr-xr-xjs/helper-classes/3D/snap-2d-record.js2
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js46
-rwxr-xr-xjs/helper-classes/3D/vec-utils.js16
-rwxr-xr-xjs/helper-classes/3D/view-utils.js12
-rwxr-xr-xjs/helper-classes/backup-delete/GLAnchorPoint.js (renamed from js/helper-classes/RDGE/GLAnchorPoint.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLBrushStroke.js (renamed from js/helper-classes/RDGE/GLBrushStroke.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLCircle.js (renamed from js/helper-classes/RDGE/GLCircle.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLGeomObj.js (renamed from js/helper-classes/RDGE/GLGeomObj.js)4
-rwxr-xr-xjs/helper-classes/backup-delete/GLLight.js (renamed from js/helper-classes/RDGE/GLLight.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLLine.js (renamed from js/helper-classes/RDGE/GLLine.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLMaterial.js (renamed from js/helper-classes/RDGE/GLMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLPath.js (renamed from js/helper-classes/RDGE/GLPath.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLRectangle.js (renamed from js/helper-classes/RDGE/GLRectangle.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLSubpath.js (renamed from js/helper-classes/RDGE/GLSubpath.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/GLWorld.js (renamed from js/helper-classes/RDGE/GLWorld.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/BumpMetalMaterial.js (renamed from js/helper-classes/RDGE/Materials/BumpMetalMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/DeformMaterial.js (renamed from js/helper-classes/RDGE/Materials/DeformMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/FlatMaterial.js (renamed from js/helper-classes/RDGE/Materials/FlatMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/FlyMaterial.js (renamed from js/helper-classes/RDGE/Materials/FlyMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/JuliaMaterial.js (renamed from js/helper-classes/RDGE/Materials/JuliaMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js (renamed from js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/LinearGradientMaterial.js (renamed from js/helper-classes/RDGE/Materials/LinearGradientMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/MandelMaterial.js (renamed from js/helper-classes/RDGE/Materials/MandelMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/PlasmaMaterial.js (renamed from js/helper-classes/RDGE/Materials/PlasmaMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/PulseMaterial.js (renamed from js/helper-classes/RDGE/Materials/PulseMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/RadialBlurMaterial.js (renamed from js/helper-classes/RDGE/Materials/RadialBlurMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/RadialGradientMaterial.js (renamed from js/helper-classes/RDGE/Materials/RadialGradientMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/ReliefTunnelMaterial.js (renamed from js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/SquareTunnelMaterial.js (renamed from js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/StarMaterial.js (renamed from js/helper-classes/RDGE/Materials/StarMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/TaperMaterial.js (renamed from js/helper-classes/RDGE/Materials/TaperMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/TunnelMaterial.js (renamed from js/helper-classes/RDGE/Materials/TunnelMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/TwistMaterial.js (renamed from js/helper-classes/RDGE/Materials/TwistMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/TwistVertMaterial.js (renamed from js/helper-classes/RDGE/Materials/TwistVertMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/Materials/UberMaterial.js (renamed from js/helper-classes/RDGE/Materials/UberMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/WaterMaterial.js (renamed from js/helper-classes/RDGE/Materials/WaterMaterial.js)0
-rw-r--r--js/helper-classes/backup-delete/Materials/ZInvertMaterial.js (renamed from js/helper-classes/RDGE/Materials/ZInvertMaterial.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/MaterialsLibrary.js (renamed from js/helper-classes/RDGE/MaterialsLibrary.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/ParseUtils.js (renamed from js/helper-classes/3D/ParseUtils.js)0
-rwxr-xr-xjs/helper-classes/backup-delete/glUtils.js (renamed from js/helper-classes/3D/glUtils.js)0
45 files changed, 59 insertions, 89 deletions
diff --git a/js/helper-classes/3D/Rectangle.js b/js/helper-classes/3D/Rectangle.js
index e797eedf..b8906f18 100755
--- a/js/helper-classes/3D/Rectangle.js
+++ b/js/helper-classes/3D/Rectangle.js
@@ -35,7 +35,7 @@ var Rectangle = exports.Rectangle = Object.create(Object.prototype, {
35 getTop: { value: function() { return this.m_top; } }, 35 getTop: { value: function() { return this.m_top; } },
36 setTop: { value: function(t) { this.m_top = t; } }, 36 setTop: { value: function(t) { this.m_top = t; } },
37 37
38 getCenter: { value: function() { return Vector.create( [this.m_left + 0.5*this.m_width, this.m_top + 0.5*this.m_height] ); } }, 38 getCenter: { value: function() { return [this.m_left + 0.5*this.m_width, this.m_top + 0.5*this.m_height]; } },
39 39
40 getWidth: { value: function() { return this.m_width; } }, 40 getWidth: { value: function() { return this.m_width; } },
41 setWidth: { value: function(w) { this.m_width = w; } }, 41 setWidth: { value: function(w) { this.m_width = w; } },
diff --git a/js/helper-classes/3D/StageLine.js b/js/helper-classes/3D/StageLine.js
index e0e7a8e3..b86673d1 100755
--- a/js/helper-classes/3D/StageLine.js
+++ b/js/helper-classes/3D/StageLine.js
@@ -149,8 +149,8 @@ var StageLine = exports.StageLine = Object.create(Object.prototype, {
149 var vec = vecUtils.vecSubtract(3, bPt1, bPt0); 149 var vec = vecUtils.vecSubtract(3, bPt1, bPt0);
150 if (plane.isBackFacing()) 150 if (plane.isBackFacing())
151 MathUtils.negate( vec ); 151 MathUtils.negate( vec );
152 planeEq = Vector.create( [-vec[1], vec[0], 0] ); 152 planeEq = [-vec[1], vec[0], 0];
153 var normal = Vector.create( [planeEq[0], planeEq[1], planeEq[2]] ); 153 var normal = [planeEq[0], planeEq[1], planeEq[2]];
154// var d = -planeEq.dot(bPt0); 154// var d = -planeEq.dot(bPt0);
155 var d = -vecUtils.vecDot(3, planeEq, bPt0); 155 var d = -vecUtils.vecDot(3, planeEq, bPt0);
156 planeEq[3] = d; 156 planeEq[3] = d;
@@ -414,8 +414,8 @@ var StageLine = exports.StageLine = Object.create(Object.prototype, {
414 if (pt0[1] < pt1[1]) { yMin = pt0[1]; yMax = pt1[1]; } else { yMin = pt1[1]; yMax = pt0[1]; } 414 if (pt0[1] < pt1[1]) { yMin = pt0[1]; yMax = pt1[1]; } else { yMin = pt1[1]; yMax = pt0[1]; }
415 if (pt0[2] < pt1[2]) { zMin = pt0[2]; zMax = pt1[2]; } else { zMin = pt1[2]; zMax = pt0[2]; } 415 if (pt0[2] < pt1[2]) { zMin = pt0[2]; zMax = pt1[2]; } else { zMin = pt1[2]; zMax = pt0[2]; }
416 416
417 this._minPt = Vector.create( [xMin, yMin, zMin] ); 417 this._minPt = [xMin, yMin, zMin];
418 this._maxPt = Vector.create( [xMax, yMax, zMax] ); 418 this._maxPt = [xMax, yMax, zMax];
419 } 419 }
420 }//, 420 }//,
421 421
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 85870097..02d946ae 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -123,7 +123,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
123 this._planesArray = []; 123 this._planesArray = [];
124 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); 124 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas);
125 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); 125 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage );
126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) ); 126 this.setWorkingPlane( [0,0,1,0] );
127 127
128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
129 if(this.application.ninja.currentDocument._liveNodeList.length > 0){ 129 if(this.application.ninja.currentDocument._liveNodeList.length > 0){
diff --git a/js/helper-classes/3D/element-planes.js b/js/helper-classes/3D/element-planes.js
index 7ccf311e..38a7bf47 100755
--- a/js/helper-classes/3D/element-planes.js
+++ b/js/helper-classes/3D/element-planes.js
@@ -88,7 +88,7 @@ var ElementPlanes = exports.ElementPlanes = Object.create(Object.prototype, {
88 // create the plane equation 88 // create the plane equation
89 //var d = -( nrm.dot( this._boundaryPts[0]) ); 89 //var d = -( nrm.dot( this._boundaryPts[0]) );
90 var d = -vecUtils.vecDot(3, nrm, this._boundaryPts[0]); 90 var d = -vecUtils.vecDot(3, nrm, this._boundaryPts[0]);
91 var planeEq = Vector.create( [nrm[0], nrm[1], nrm[2], d] ); 91 var planeEq = [nrm[0], nrm[1], nrm[2], d] ;
92 this.setPlaneEq( planeEq ); 92 this.setPlaneEq( planeEq );
93 93
94 // get the 2D rectangle 94 // get the 2D rectangle
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js
index de63f880..562a6e73 100755
--- a/js/helper-classes/3D/math-utils.js
+++ b/js/helper-classes/3D/math-utils.js
@@ -86,7 +86,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
86 if (b.length < n) n = b.length; 86 if (b.length < n) n = b.length;
87 if (n > 0) 87 if (n > 0)
88 { 88 {
89 rtnVec = Vector.create([0]); 89 rtnVec = [0];
90 for (var i=0; i<n; i++) 90 for (var i=0; i<n; i++)
91 rtnVec[i] = a[i] - b[i]; 91 rtnVec[i] = a[i] - b[i];
92 } 92 }
@@ -103,7 +103,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
103 if (b.length < n) n = b.length; 103 if (b.length < n) n = b.length;
104 if (n > 0) 104 if (n > 0)
105 { 105 {
106 rtnVec = Vector.create([0]); 106 rtnVec = [0];
107 for (var i=0; i<n; i++) 107 for (var i=0; i<n; i++)
108 rtnVec[i] = a[i] + b[i]; 108 rtnVec[i] = a[i] + b[i];
109 } 109 }
@@ -145,9 +145,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
145 { 145 {
146 var x0 = pt0[0], y0 = pt0[1], z0 = pt0[2]; 146 var x0 = pt0[0], y0 = pt0[1], z0 = pt0[2];
147 var dx = vec[0], dy = vec[1], dz = vec[2]; 147 var dx = vec[0], dy = vec[1], dz = vec[2];
148 rtnPt = Vector.create( [x0 + t*dx, 148 rtnPt = [x0 + t*dx, y0 + t*dy, z0 + t*dz] ;
149 y0 + t*dy,
150 z0 + t*dz] );
151 } 149 }
152 150
153 return rtnPt; 151 return rtnPt;
@@ -267,11 +265,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
267 { 265 {
268 var x0 = pt0[0], y0 = pt0[1], z0 = pt0[2], 266 var x0 = pt0[0], y0 = pt0[1], z0 = pt0[2],
269 x1 = pt1[0], y1 = pt1[1], z1 = pt1[2]; 267 x1 = pt1[0], y1 = pt1[1], z1 = pt1[2];
270 var pt = Vector.create( [ 268 var pt = [ x0 + t*(x1 - x0), y0 + t*(y1 - y0), z0 + t*(z1 - z0) ];
271 x0 + t*(x1 - x0),
272 y0 + t*(y1 - y0),
273 z0 + t*(z1 - z0)
274 ] );
275 269
276 return pt; 270 return pt;
277 } 271 }
@@ -359,8 +353,7 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
359 return null; //no intersection unless the the intersection point lies on both segments 353 return null; //no intersection unless the the intersection point lies on both segments
360 } 354 }
361 355
362 var intPt = Vector.create([seg0Start[0] + paramSeg0 * (seg0End[0] - seg0Start[0]), 356 var intPt = [seg0Start[0] + paramSeg0 * (seg0End[0] - seg0Start[0]), seg0Start[1] + paramSeg0 * (seg0End[1] - seg0Start[1])];
363 seg0Start[1] + paramSeg0 * (seg0End[1] - seg0Start[1])]);