From: <ha...@us...> - 2014-05-27 22:04:48
|
Revision: 19750 http://sourceforge.net/p/jmol/code/19750 Author: hansonr Date: 2014-05-27 22:04:41 +0000 (Tue, 27 May 2014) Log Message: ----------- ___JmolVersion="14.1.16_2014.05.27d" bug fix: Chrome errant zero mouse move causes collapse of rotation matrix Modified Paths: -------------- trunk/Jmol/src/javajs/util/M3.java trunk/Jmol/src/javajs/util/Quat.java trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java trunk/Jmol/src/org/jmol/modelset/ModelSet.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/TransformManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/javajs/util/M3.java =================================================================== --- trunk/Jmol/src/javajs/util/M3.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/javajs/util/M3.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -607,12 +607,15 @@ * @param responseFactor Jmol uses 0.02 here * @param dx * @param dy + * @return true if successful; false if not; */ - public void setAsBallRotation(float responseFactor, float dx, float dy) { + public boolean setAsBallRotation(float responseFactor, float dx, float dy) { float r = (float) Math.sqrt(dx * dx + dy * dy); float th = r * responseFactor; - if (th == 0) - return; + if (th == 0) { + setScale(1); + return false; + } float c = (float) Math.cos(th); float s = (float) Math.sin(th); float nx = -dy / r; @@ -624,6 +627,7 @@ m11 = 1 + c1 * ny * ny; m21 = -(m12 = s * ny); m22 = c; + return true; } public boolean isRotation() { Modified: trunk/Jmol/src/javajs/util/Quat.java =================================================================== --- trunk/Jmol/src/javajs/util/Quat.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/javajs/util/Quat.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -64,7 +64,7 @@ public static Quat newM(M3 mat) { Quat q = new Quat(); - q.setM(mat); + q.setM(M3.newM3(mat)); return q; } @@ -148,7 +148,7 @@ setM(new M3().setAA(aa)); } - public void setM(M3 mat) { + private void setM(M3 mat) { /* * Changed 7/16/2008 to double precision for 11.5.48. Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -1009,32 +1009,32 @@ && (desiredVibrationNumber <= 0 || vibrationNumber == desiredVibrationNumber); } - private M3 matrixRotate; + private M3 matRot; public MSInterface ms; public void setTransform(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) { - if (matrixRotate != null || !doSetOrientation) + if (matRot != null || !doSetOrientation) return; - matrixRotate = new M3(); + matRot = new M3(); V3 v = V3.new3(x1, y1, z1); // rows in Sygress/CAChe and Spartan become columns here v.normalize(); - matrixRotate.setColumnV(0, v); + matRot.setColumnV(0, v); v.set(x2, y2, z2); v.normalize(); - matrixRotate.setColumnV(1, v); + matRot.setColumnV(1, v); v.set(x3, y3, z3); v.normalize(); - matrixRotate.setColumnV(2, v); + matRot.setColumnV(2, v); asc.setInfo( - "defaultOrientationMatrix", M3.newM3(matrixRotate)); + "defaultOrientationMatrix", M3.newM3(matRot)); // first two matrix column vectors define quaternion X and XY plane - Quat q = Quat.newM(matrixRotate); + Quat q = Quat.newM(matRot); asc.setInfo( "defaultOrientationQuaternion", q); - Logger.info("defaultOrientationMatrix = " + matrixRotate); + Logger.info("defaultOrientationMatrix = " + matRot); } Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -3988,16 +3988,16 @@ } - public void moveAtoms(M3 mNew, M3 matrixRotate, V3 translation, BS bs, + public void moveAtoms(M3 mNew, M3 rotation, V3 translation, BS bs, P3 center, boolean isInternal, boolean translationOnly) { if (!translationOnly) { if (mNew == null) { - matTemp.setM3(matrixRotate); + matTemp.setM3(rotation); } else { - matInv.setM3(matrixRotate); + matInv.setM3(rotation); matInv.invert(); ptTemp.set(0, 0, 0); - matTemp.mul2(mNew, matrixRotate); + matTemp.mul2(mNew, rotation); matTemp.mul2(matInv, matTemp); } if (isInternal) { Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-05-27 22:04:41 UTC (rev 19750) @@ -11,8 +11,9 @@ # The quotes above look odd for a parameter file, but they are # important for the JavaScript version of Jmol. -___JmolVersion="14.1.16_2014.05.27c" +___JmolVersion="14.1.16_2014.05.27d" +bug fix: Chrome errant zero mouse move causes collapse of rotation matrix bug fix: drag-drop followed by model building may fail. code: TransformManager clean-up; Modified: trunk/Jmol/src/org/jmol/viewer/TransformManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/org/jmol/viewer/TransformManager.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -318,8 +318,8 @@ // probably has to do with the fact that we are changing // the signs of both screen Y and screen Z in the end. - matrixTemp3.setAsBallRotation(JC.radiansPerDegree, -yDeg, -xDeg); - applyRotation(matrixTemp3, false, bsAtoms, null, false); + if (matrixTemp3.setAsBallRotation(JC.radiansPerDegree, -yDeg, -xDeg)) + applyRotation(matrixTemp3, false, bsAtoms, null, false); } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2014-05-27 18:33:39 UTC (rev 19749) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2014-05-27 22:04:41 UTC (rev 19750) @@ -7712,12 +7712,12 @@ sm.setStatusAtomMoved(bs); } - public void moveAtoms(M3 mNew, M3 matrixRotate, V3 translation, + public void moveAtoms(M3 mNew, M3 rotation, V3 translation, P3 center, boolean isInternal, BS bsAtoms, boolean translationOnly) { // from TransformManager exclusively if (bsAtoms.cardinality() == 0) return; - ms.moveAtoms(mNew, matrixRotate, translation, bsAtoms, center, + ms.moveAtoms(mNew, rotation, translation, bsAtoms, center, isInternal, translationOnly); checkMinimization(); sm.setStatusAtomMoved(bsAtoms); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |