Revision: 18243
          http://sourceforge.net/p/jmol/code/18243
Author:   hansonr
Date:     2013-05-23 18:01:55 +0000 (Thu, 23 May 2013)
Log Message:
-----------
___JmolVersion="13.1.16_dev_2013.05.23"

PyMOL: perspective fix for translated center -- H115W.PinM.PSE

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/TransformManager.java

Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-05-23 17:26:12 UTC 
(rev 18242)
+++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-05-23 18:01:55 UTC 
(rev 18243)
@@ -6795,16 +6795,14 @@
           if (!isChange && Math.abs(cameraDepth - viewer.getCameraDepth()) >= 
0.01f)
             isChange = true;
         }
-        if (i != slen) {
+        if (i + 1 < slen) {
           cameraX = floatParameter(i++);
-        }
-        if (i != slen) {
           cameraY = floatParameter(i++);
+          if (!isChange && Math.abs(cameraX - viewer.getCamera().x) >= 0.01f) 
+            isChange = true;
+          if (!isChange && Math.abs(cameraY - viewer.getCamera().y) >= 0.01f)
+            isChange = true;
         }
-        if (!isChange && Math.abs(cameraX - viewer.getCamera().x) >= 0.01f) 
-          isChange = true;
-        if (!isChange && Math.abs(cameraY - viewer.getCamera().y) >= 0.01f)
-          isChange = true;
       }
     }
     checkLength(i);

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-05-23 17:26:12 UTC 
(rev 18242)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-05-23 18:01:55 UTC 
(rev 18243)
@@ -16,7 +16,7 @@
   -- view only
   -- use RESTORE ORIENTATION xxxxx 
 
-new feature: added parameter to moveTo allows cameraDepth setting
+new feature: added parameters to moveTo allows setting cameraDepth, cameraX, 
and cameraY
 new feature: moveTo <nseconds> PYMOL [18-element standard PyMOL view matrix]
        -- used for PSE file loading
        -- to be used also for scenes 

Modified: trunk/Jmol/src/org/jmol/viewer/TransformManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/TransformManager.java        2013-05-23 
17:26:12 UTC (rev 18242)
+++ trunk/Jmol/src/org/jmol/viewer/TransformManager.java        2013-05-23 
18:01:55 UTC (rev 18243)
@@ -506,6 +506,7 @@
    ****************************************************************/
   public final P3 fixedTranslation = new P3();
   public final P3 camera = new P3();
+  public final P3 cameraSetting = new P3();
 
   float xTranslationFraction = 0.5f;
   float yTranslationFraction = 0.5f;
@@ -556,9 +557,7 @@
   }
 
   public void setCamera(float x, float y) {
-    camera.x = x;
-    camera.y = y;
-    camera.z = (x == 0 && y == 0 ? 0 : 1);
+    cameraSetting.set(x, y, (x == 0 && y == 0 ? 0 : 1));
   }
 
   public void translateToPercent(char type, float percent) {
@@ -1363,6 +1362,7 @@
   public synchronized void finalizeTransformParameters() {
     haveNotifiedNaN = false;
     fixedRotationOffset.setT(fixedTranslation);
+    camera.setT(cameraSetting);
     internalSlab = slabEnabled && (slabPlane != null || depthPlane != null);
     float newZoom = getZoomSetting();
     if (zoomPercent != newZoom) {
@@ -1638,8 +1638,6 @@
 
     // other units are percent; this factor is 100% / (2*rotationRadius)
     float f = 50 / rotationRadius;
-    float xTrans = cameraX * f / width * screenPixelCount;
-    float yTrans = cameraY * f / height * screenPixelCount;
 
     if (pymolDistanceToSlab > 0) {
       int slab = 50 + (int) ((pymolDistanceToCenter - pymolDistanceToSlab) * 
f);
@@ -1666,7 +1664,7 @@
         }
       }
     }
-    moveTo(eval, floatSecondsTotal, center, null, 0, m3, 100, xTrans, yTrans,
+    moveTo(eval, floatSecondsTotal, center, null, 0, m3, 100, Float.NaN, 
Float.NaN,
         rotationRadius, null, Float.NaN, Float.NaN, Float.NaN, cameraDepth, 
cameraX, cameraY);
   }
 
@@ -1701,6 +1699,10 @@
         matrixEnd.setAA(aaMoveTo);
       }
     }
+    if (!Float.isNaN(cameraX))
+      xTrans = cameraX * 50 / newRotationRadius / width * screenPixelCount;
+    if (!Float.isNaN(cameraY))
+      yTrans = cameraY * 50 / newRotationRadius / height * screenPixelCount;
     try {
       if (motion == null)
         motion = new MoveToThread(this, viewer);
@@ -1775,8 +1777,8 @@
     if (addComments)
       sb.append(" /* cameraDepth, cameraX, cameraY */ ");
     truncate2(sb, cameraDepth);
-    truncate2(sb, camera.x);
-    truncate2(sb, camera.y);
+    truncate2(sb, cameraSetting.x);
+    truncate2(sb, cameraSetting.y);
     sb.append(";");
     return sb.toString();
   }
@@ -2306,8 +2308,8 @@
       mode = (camera.z == 0 ? MODE_STANDARD : MODE_PERSPECTIVE_PYMOL);
     // still not 100% certain why we have to do this, but H115W.PinM.PSE 
requires it
     perspectiveShiftXY.set(camera.z == 0 ? 0 : camera.x
-        * scalePixelsPerAngstrom / width * 100, camera.z == 0 ? 0 : camera.y
-        * scalePixelsPerAngstrom / height * 100 , 0);
+        * scalePixelsPerAngstrom / screenWidth * 100, camera.z == 0 ? 0 : 
camera.y
+        * scalePixelsPerAngstrom / screenHeight * 100 , 0);
 
     // model radius in pixels
     modelRadiusPixels = modelRadius * scalePixelsPerAngstrom; // (s)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to