diff options
author | Pushkar Joshi | 2012-03-06 17:04:40 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-03-06 17:04:40 -0800 |
commit | 7a43958033906b2273de88bc2a26cda7a905d202 (patch) | |
tree | f71817e712c4b07a48257a4f0b206cf9033421df /js/tools/drawing-tool-base.js | |
parent | 264e3d8e6d3624083d2fab9fe2560234553bb2ad (diff) | |
parent | 2e3943a8f751ec572066f168b58464c24b9f29e5 (diff) | |
download | ninja-7a43958033906b2273de88bc2a26cda7a905d202.tar.gz |
Merge branch 'master' into brushtool
Diffstat (limited to 'js/tools/drawing-tool-base.js')
-rwxr-xr-x | js/tools/drawing-tool-base.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index cd895102..8d87605c 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js | |||
@@ -205,11 +205,11 @@ exports.DrawingToolBase = Montage.create(Montage, { | |||
205 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); | 205 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); |
206 | } else { | 206 | } else { |
207 | var vec = vecUtils.vecSubtract(3, s1, s0 ); | 207 | var vec = vecUtils.vecSubtract(3, s1, s0 ); |
208 | var yAxis = Vector.create([0,1,0]); | 208 | var yAxis = [0,1,0]; |
209 | var tmp = vecUtils.vecCross( 3, vec, yAxis ); | 209 | var tmp = vecUtils.vecCross( 3, vec, yAxis ); |
210 | var mag = vecUtils.vecMag(3, tmp); | 210 | var mag = vecUtils.vecMag(3, tmp); |
211 | if (MathUtils.fpSign(mag) === 0) { | 211 | if (MathUtils.fpSign(mag) === 0) { |
212 | thePlane = Vector.create( [0,0,1] ); | 212 | thePlane = [0,0,1]; |
213 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); | 213 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); |
214 | } else { | 214 | } else { |
215 | var xAxis = vecUtils.vecCross( 3, yAxis, tmp ); | 215 | var xAxis = vecUtils.vecCross( 3, yAxis, tmp ); |
@@ -336,12 +336,12 @@ exports.DrawingToolBase = Montage.create(Montage, { | |||
336 | else | 336 | else |
337 | { | 337 | { |
338 | var vec = vecUtils.vecSubtract(3, s1, s0 ); | 338 | var vec = vecUtils.vecSubtract(3, s1, s0 ); |
339 | var yAxis = Vector.create([0,1,0]); | 339 | var yAxis = [0,1,0]; |
340 | var tmp = vecUtils.vecCross( 3, vec, yAxis ); | 340 | var tmp = vecUtils.vecCross( 3, vec, yAxis ); |
341 | var mag = vecUtils.vecMag(3, tmp); | 341 | var mag = vecUtils.vecMag(3, tmp); |
342 | if (MathUtils.fpSign(mag) === 0) | 342 | if (MathUtils.fpSign(mag) === 0) |
343 | { | 343 | { |
344 | thePlane = Vector.create( [0,0,1] ); | 344 | thePlane = [0,0,1]; |
345 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); | 345 | thePlane[3] = -vecUtils.vecDot(3, thePlane, s0); |
346 | } | 346 | } |
347 | else | 347 | else |
@@ -379,7 +379,7 @@ exports.DrawingToolBase = Montage.create(Montage, { | |||
379 | 379 | ||
380 | } | 380 | } |
381 | 381 | ||
382 | var localPt = Vector.create([p0[0], p0[1], 0.0, 1.0]); | 382 | var localPt = [p0[0], p0[1], 0.0, 1.0]; |
383 | s0 = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt ); | 383 | s0 = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt ); |
384 | s0 = vecUtils.vecAdd(3, viewUtils.viewToScreen( MathUtils.transformPoint(s0, stageMat) ), offset ); | 384 | s0 = vecUtils.vecAdd(3, viewUtils.viewToScreen( MathUtils.transformPoint(s0, stageMat) ), offset ); |
385 | 385 | ||
@@ -513,8 +513,8 @@ exports.DrawingToolBase = Montage.create(Montage, { | |||
513 | var z = p0[2]; | 513 | var z = p0[2]; |
514 | 514 | ||
515 | // fill in the other 2 points on the plane to complete the 4 points | 515 | // fill in the other 2 points on the plane to complete the 4 points |
516 | var p1 = Vector.create( [p0[0], p2[1], z] ), | 516 | var p1 = [p0[0], p2[1], z], |
517 | p3 = Vector.create( [p2[0], p0[1], z] ); | 517 | p3 = [p2[0], p0[1], z]; |
518 | 518 | ||
519 | // convert back to 3D space | 519 | // convert back to 3D space |
520 | s0 = MathUtils.transformPoint( p0, planeMat ); | 520 | s0 = MathUtils.transformPoint( p0, planeMat ); |
@@ -633,8 +633,8 @@ exports.DrawingToolBase = Montage.create(Montage, { | |||
633 | var pt0 = ptArr[0], pt2 = ptArr[1]; | 633 | var pt0 = ptArr[0], pt2 = ptArr[1]; |
634 | z = pt0[2]; | 634 | z = pt0[2]; |
635 | pt0[2] = z; pt2[2] = z; | 635 | pt0[2] = z; pt2[2] = z; |
636 | var pt1 = Vector.create( [pt0[0], pt2[1], z] ), | 636 | var pt1 = [pt0[0], pt2[1], z], |
637 | pt3 = Vector.create( [pt2[0], pt0[1], z] ); | 637 | pt3 = [pt2[0], pt0[1], z]; |
638 | 638 | ||
639 | // | 639 | // |
640 | ptArr = [pt0, pt1, pt2, pt3]; | 640 | ptArr = [pt0, pt1, pt2, pt3]; |