From b2ce8b819cc85a558d862c04965b7e65a6ce8640 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 1 Feb 2012 13:05:32 -0800 Subject: changes to allow minimal rendering ofnon-animated materials. --- js/helper-classes/3D/snap-manager.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 3ed96082..8819f637 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1780,7 +1780,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var mergedSnap = this.mergeHitRecords( hitRecs ); if (mergedSnap) { - while (hitRecs.length > 0) hitRecs.pop(); + while (hitRecs.length > 0) hitRecs.pop(); hitRecs.push( mergedSnap ); //console.log( "merged snaps" ); } @@ -1836,6 +1836,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { hSnap.setLocalPoint( localPt ); hSnap.setScreenPoint( scrPt ); hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); + hSnap.setElement( stage ); + hSnap.setPlane( [0,0,1,0] ); + hSnap.setPlaneMatrix( Matrix.I(4) ); if (vSnap.hasAssociatedScreenPoint() ) hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); if (vSnap.hasAssociatedScreenPoint2() ) @@ -1882,6 +1885,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { hSnap.setLocalPoint( localPt ); hSnap.setScreenPoint( scrPt ); hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); + hSnap.setElement( stage ); + hSnap.setPlane( [0,0,1,0] ); + hSnap.setPlaneMatrix( Matrix.I(4) ); if (vSnap.hasAssociatedScreenPoint() ) hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); if (vSnap.hasAssociatedScreenPoint2() ) @@ -1934,6 +1940,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { hSnap.setLocalPoint( localPt ); hSnap.setScreenPoint( scrPt ); hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); + hSnap.setElement( stage ); + hSnap.setPlane( [0,0,1,0] ); + hSnap.setPlaneMatrix( Matrix.I(4) ); if (vSnap.hasAssociatedScreenPoint() ) hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); if (vSnap.hasAssociatedScreenPoint2() ) -- cgit v1.2.3 From 823945a2bcb42bbf9c6a1cd0ef723b8f415e557f Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 1 Feb 2012 14:39:46 -0800 Subject: factor in the zoom factor when drawing the stage compass. --- js/helper-classes/3D/draw-utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index c26a5cd1..fd96af4d 100644 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1089,7 +1089,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var resMat = glmat4.multiply( tMat, mat, [] ); var origin = [0,0,0,1]; - var arrowSize = 50; + var zoomFactor = this.application.ninja.documentBar.zoomFactor/100.0; + var arrowSize = 50 / zoomFactor; var xAxis = [arrowSize,0,0,1]; //var rO = resMat.multiply(origin); var rO = glmat4.multiplyVec3( resMat, origin, []); -- cgit v1.2.3 From 802e92eb70b00849dadacf2c6590d27edbe65d99 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 8 Feb 2012 15:39:47 -0800 Subject: bug fixes for better anchor point rotation and removing snapping on hover and mouse down --- js/helper-classes/3D/math-utils.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js index 71ed62a0..3d24f76e 100644 --- a/js/helper-classes/3D/math-utils.js +++ b/js/helper-classes/3D/math-utils.js @@ -802,19 +802,21 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, { getAxisAngleBetween3DVectors: { value: function (vec1, vec2, axis) { //compute magnitudes of the vectors - var mag1 = VecUtils.vecMag(3, vec1); - var mag2 = VecUtils.vecMag(3, vec2); - - if (mag1 < this.EPSILON || mag2 < this.EPSILON) { - return 0; //if angle 0 is returned nothing from this function should be used - } + var v1n = VecUtils.vecNormalize(3, vec1, 1.0); + var v2n = VecUtils.vecNormalize(3, vec2, 1.0); //angle between the vectors (acos for now...) - var angle = Math.acos(VecUtils.vecDot(3, vec1, vec2) / (mag1 * mag2)); + var angle = Math.acos(VecUtils.vecDot(3, v1n, v2n)); if (Math.abs(angle) < this.EPSILON) { return 0; } + //TODO testing...remove this block + console.log("getAxisAngleBetween3DVectors Angle: "+angle); + if (isNaN(angle)){ + console.log("getAxisAngleBetween3DVectors Angle is NaN"); + } + //TODO end testing block //optionally, if axis is provided, create the axis of rotation as well - var rotAxis = VecUtils.vecCross(3, vec1, vec2); + var rotAxis = VecUtils.vecCross(3, v1n, v2n); rotAxis = VecUtils.vecNormalize(3, rotAxis, 1); axis[0] = rotAxis[0]; axis[1] = rotAxis[1]; -- cgit v1.2.3