Revision: 20853
          http://sourceforge.net/p/jmol/code/20853
Author:   hansonr
Date:     2015-11-01 18:15:50 +0000 (Sun, 01 Nov 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.5.0_2015.11.01"

new feature: polyhedra ID xxx SCALE x.x
  -- ID named polyhedra only
  -- x.x is the scaling factor, initially 1 
  -- x.x < 0 does "explode" from {0 0 0} (for higher-order Brillouin zones, for 
instance)
  -- x.x > 0 does normal scaling
bug fix: slabbing should reset area and volume of isosurface
bug fix: meshSlicer may fail to add edge to sliced pmesh
 
FEATURE CHANGE: (Application only for now) PDB default for =xxxx 
  -- changed to 
    "pdb", 
"http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz";
  -- will be complemented with file.ent for non-binary transfer, but that is 
not implemented yet at RCSB
  -- mmCIF counterpart not implemented yet.
  -- not HTML5 because for that we need the option to remove .gz

new feature: set testflag3 TRUE  gives random triangle effect to polyhedra

new feature: POLYHEDRON ID "xxx" OFFSET {3 3 3}
 -- allows cartesian offset of named polyhedra
 
bug fix: bug fix: empty format crashes Jmol --  print "testing".format("")
bug fix: polyhedron volume will be incorrect if there is a 
         face triangle that has no edges visible (requires a six or more sided 
face)  

bug fix: nested if...{...if... } else {...} gives compiler syntax error:

  if (i=1) {
    print "i=1"
    if (j=1)
      print "j != 1" 
  } else {                // } closes if (j=1) instead of if (i=1) {
    print "i != 1"
  }

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
    trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java
    trunk/Jmol/src/org/jmol/script/SV.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/scriptext/IsoExt.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
    trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java
    trunk/Jmol/src/org/jmol/util/MeshSlicer.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/ShapeManager.java

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java  2015-10-30 
12:08:02 UTC (rev 20852)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java  2015-11-01 
18:15:50 UTC (rev 20853)
@@ -314,9 +314,10 @@
         return true;
       } else if (AU.isAS(value)) {
         params.title = (String[]) value;
-        for (int i = 0; i < params.title.length; i++)
-          if (params.title[i].length() > 0)
-            Logger.info(params.title[i]);
+        if (Logger.debugging)
+         for (int i = 0; i < params.title.length; i++)
+           if (params.title[i].length() > 0)
+             Logger.info(params.title[i]);
       }
       return true;
     }

Modified: trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java        
2015-10-30 12:08:02 UTC (rev 20852)
+++ trunk/Jmol/src/org/jmol/renderspecial/PolyhedraRenderer.java        
2015-11-01 18:15:50 UTC (rev 20853)
@@ -35,6 +35,8 @@
 
 import javajs.util.P3;
 import javajs.util.P3i;
+import javajs.util.T3;
+import javajs.util.V3;
 
 public class PolyhedraRenderer extends ShapeRenderer {
 
@@ -69,6 +71,7 @@
     short[] colixes = ((Polyhedra) shape).colixes;
     int iAtom = -1;
     short colix;
+    float scale = 1;
     if (p.id == null) {
       iAtom = p.centralAtom.i;
       colix = (colixes == null || iAtom >= colixes.length ? C.INHERIT_ALL
@@ -76,6 +79,7 @@
       colix = C.getColixInherited(colix, p.centralAtom.colixAtom);
     } else {
       colix = p.colix;
+      scale = p.scale;
     }
     boolean needTranslucent = false;
     if (C.renderPass2(colix)) {
@@ -83,7 +87,28 @@
     } else if (!g3d.setC(colix)) {
       return false;
     }
-    P3[] vertices = p.vertices;
+    T3[] vertices = p.vertices;
+    if (scale != 1) {
+      T3[] v = new T3[vertices.length];
+      if (scale < 0) {
+        // explode from {0 0 0}
+        V3 a = V3.newV(p.center);
+        a.scale(-scale - 1);
+        for (int i = v.length; --i >= 0;) {
+          V3 b = V3.newV(vertices[i]);
+          b.add(a);
+          v[i] = b;
+        }
+      } else {
+        // enlarge
+        for (int i = v.length; --i >= 0;) {
+          V3 a = V3.newVsub(vertices[i], p.center);
+          a.scaleAdd2(scale, a, p.center);
+          v[i] = a;
+        }
+      }
+      vertices = v;
+    }
     if (screens3f == null || screens3f.length < vertices.length) {
       screens3f = new P3[vertices.length];
       for (int i = vertices.length; --i >= 0;)

Modified: trunk/Jmol/src/org/jmol/script/SV.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/SV.java      2015-10-30 12:08:02 UTC (rev 
20852)
+++ trunk/Jmol/src/org/jmol/script/SV.java      2015-11-01 18:15:50 UTC (rev 
20853)
@@ -1444,9 +1444,8 @@
 
   /**
    * 
-   * Script variables are pushed after cloning, because
-   * the name comes with them when we do otherwise
-   * they are not mutable anyway. We do want to have actual
+   * Script variables are pushed after cloning, because the name comes with 
them
+   * when we do otherwise they are not mutable anyway. We do want to have 
actual
    * references to points, lists, and associative arrays
    * 
    * @param value
@@ -1455,12 +1454,23 @@
    * @return array
    */
   public SV pushPop(SV value, SV mapKey) {
-    if (mapKey != null  ) {
+    if (mapKey != null) {
       Map<String, SV> m = getMap();
       if (value == null) {
-        SV v;
-        return (m == null || (v = m.remove(mapKey.asString())) == null ? 
-            newS("") : v);
+        SV v = null;
+        if (m == null) {
+          Lst<SV> lst = getList();
+          int len = lst.size();
+          int i = iValue(mapKey) - 1;
+          if (i < 0)
+              i += len;
+          if (i >= 0 && i < len) {
+            v = lst.remove(i);
+          }
+        } else {
+          v = m.remove(mapKey.asString());
+        }
+        return (v == null ? newS("") : v);
       }
       if (m != null)
         m.put(mapKey.asString(), newI(0).setv(value));

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -3192,6 +3192,7 @@
     boolean onOffDelete = false;
     boolean typeSeen = false;
     boolean edgeParameterSeen = false;
+    float scale = Float.NaN;
     //    int lighting = T.nada; // never implemented; fullyLit does nothing
     int nAtomSets = 0;
     eval.sm.loadShape(JC.SHAPE_POLYHEDRA);
@@ -3209,6 +3210,9 @@
         propertyValue = e.theToken.value;
         needsGenerating = true;
         break;
+      case T.scale:
+        scale = floatParameter(++i);
+        continue;
       case T.unitcell:
         if (id != null)
           invArg();
@@ -3401,11 +3405,13 @@
       if (!typeSeen && haveBonds)
         setShapeProperty(JC.SHAPE_POLYHEDRA, "bonds", null);
       setShapeProperty(JC.SHAPE_POLYHEDRA, "generate", null);
-    } else if (!edgeParameterSeen && offset == null) {// && lighting == T.nada)
+    } else if (!edgeParameterSeen && offset == null && Float.isNaN(scale)) {// 
&& lighting == T.nada)
       error(ScriptError.ERROR_insufficientArguments);
     }
     if (offset != null) 
       setShapeProperty(JC.SHAPE_POLYHEDRA, "offset", offset);
+    if (!Float.isNaN(scale))
+      setShapeProperty(JC.SHAPE_POLYHEDRA, "scale", Float.valueOf(scale));
     if (colorArgb[0] != Integer.MIN_VALUE)
       setShapeProperty(JC.SHAPE_POLYHEDRA, "colorThis",
           Integer.valueOf(colorArgb[0]));

Modified: trunk/Jmol/src/org/jmol/scriptext/IsoExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/IsoExt.java       2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/scriptext/IsoExt.java       2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -1125,6 +1125,7 @@
     boolean isPmesh = (iShape == JC.SHAPE_PMESH);
     boolean isPlot3d = (iShape == JC.SHAPE_PLOT3D);
     boolean isLcaoCartoon = (iShape == JC.SHAPE_LCAOCARTOON);
+    boolean isSilent = (isLcaoCartoon || tokAt(1) == T.delete);
     boolean surfaceObjectSeen = false;
     boolean planeSeen = false;
     boolean isMapped = false;
@@ -1185,6 +1186,10 @@
         str = paramAsStr(i);
       switch (eval.theTok) {
       // settings only
+      case T.silent:
+        isSilent = true;
+        sbCommand.append(" silent");
+        continue;
       case T.isosurfacepropertysmoothing:
         smoothing = (getToken(++i).tok == T.on ? Boolean.TRUE
             : eval.theTok == T.off ? Boolean.FALSE : null);
@@ -2732,7 +2737,7 @@
                 + Escape.eBS(bsSelect) + " ")
                 + cmd);
         s = (String) getShapeProperty(iShape, "ID");
-        if (s != null && !eval.tQuiet) {
+        if (s != null && !eval.tQuiet && !isSilent) {
           cutoff = ((Float) getShapeProperty(iShape, "cutoff")).floatValue();
           if (Float.isNaN(cutoff) && !Float.isNaN(sigma))
             Logger.error("sigma not supported");
@@ -2759,7 +2764,7 @@
             s += "\n" + svol;
         }
       }
-      if (s != null)
+      if (s != null && !isSilent)
         showString(s);
     }
     if (translucency != null)
@@ -2767,7 +2772,7 @@
     setShapeProperty(iShape, "clear", null);
     if (toCache)
       setShapeProperty(iShape, "cache", null);
-    if (iShape != JC.SHAPE_LCAOCARTOON && !isDisplay && !haveSlab)
+    if (!isSilent && !isDisplay && !haveSlab && eval.theTok != T.delete)
       listIsosurface(iShape);
   }
 

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -162,6 +162,13 @@
       return;
     }
 
+    if ("scale" == propertyName) {
+      if (thisID != null)
+        scalePolyhedra(((Float) value).floatValue());
+      return;
+      
+    }
+
     if ("model" == propertyName) {
       modelIndex = ((Integer) value).intValue();
       return;
@@ -360,6 +367,12 @@
     setPropAS(propertyName, value, bs);
   }
 
+  private void scalePolyhedra(float scale) {
+    BS bs = findPolyBS(null);
+    for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
+      polyhedrons[i].scale = scale;
+  }
+
   private void offsetPolyhedra(P3 value) {
     BS bs = findPolyBS(null);
     for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
@@ -723,15 +736,18 @@
      *  catalog. This uses the Point3i().toString() method.
      *  
      *  For these special cases, then, we define a reference point just behind 
the plane
+     *  
+     *  Note that this is NOT AN OPTION for ID-named polyhedra (Jmol 14.5.0 
10/31/2015)
      */
 
     P3 ptRef = P3.newP(ptAve);
     BS bsThroughCenter = new BS();
-    for (int pt = 0, i = 0; i < ni; i++)
-      for (int j = i + 1; j < nj; j++)
-        for (int k = j + 1; k < vertexCount; k++, pt++)
-          if (isPlanar(points[i], points[j], points[k], ptRef))
-            bsThroughCenter.set(pt);
+    if (thisID == null)
+      for (int pt = 0, i = 0; i < ni; i++)
+        for (int j = i + 1; j < nj; j++)
+          for (int k = j + 1; k < vertexCount; k++, pt++)
+            if (isPlanar(points[i], points[j], points[k], ptRef))
+              bsThroughCenter.set(pt);
     // this next check for distance allows for bond AND distance constraints
     int[][] triangles = planesT;
     P4 pTemp = new P4();
@@ -761,26 +777,27 @@
           boolean isThroughCenter = bsThroughCenter.get(pt);
           P3 rpt = (isThroughCenter ? randomPoint : ptAve);
           V3 normal = new V3();
-          boolean isWindingOK = Measure.getNormalFromCenter(rpt, points[i], 
points[j],
-              points[k], !isThroughCenter, normal, vAC);
+          boolean isWindingOK = Measure.getNormalFromCenter(rpt, points[i],
+              points[j], points[k], !isThroughCenter, normal, vAC);
           // the standard face:
           normals[triangleCount] = normal;
-          triangles[triangleCount] = new int[] { isWindingOK ? i : j, 
isWindingOK ? j : i,
-              k, -7 };
-          if (!checkFace(points, vertexCount, triangles, normals, 
triangleCount, pTemp, nTemp,
-              vAC, htNormMap, htEdgeMap, planarParam, bsTemp))
+          triangles[triangleCount] = new int[] { isWindingOK ? i : j,
+              isWindingOK ? j : i, k, -7 };
+          if (!checkFace(points, vertexCount, triangles, normals,
+              triangleCount, pTemp, nTemp, vAC, htNormMap, htEdgeMap,
+              planarParam, bsTemp))
             continue;
           if (isThroughCenter) {
             bsCenterPlanes.set(triangleCount++);
           } else if (collapsed) {
             ptRef.setT(points[nPoints] = new P3());
             points[nPoints].scaleAdd2(offset, normal, atomOrPt);
-            addFacet(i, j, k, ptRef, points, normals, triangles, 
triangleCount++, nPoints,
-                isWindingOK, vAC);
-            addFacet(k, i, j, ptRef, points, normals, triangles, 
triangleCount++, nPoints,
-                isWindingOK, vAC);
-            addFacet(j, k, i, ptRef, points, normals, triangles, 
triangleCount++, nPoints,
-                isWindingOK, vAC);
+            addFacet(i, j, k, ptRef, points, normals, triangles,
+                triangleCount++, nPoints, isWindingOK, vAC);
+            addFacet(k, i, j, ptRef, points, normals, triangles,
+                triangleCount++, nPoints, isWindingOK, vAC);
+            addFacet(j, k, i, ptRef, points, normals, triangles,
+                triangleCount++, nPoints, isWindingOK, vAC);
             nPoints++;
           } else {
             triangleCount++;
@@ -789,14 +806,16 @@
       }
     nPoints--;
     if (Logger.debugging) {
-      Logger
-          .info("Polyhedron planeCount=" + triangleCount + " nPoints=" + 
nPoints);
+      Logger.info("Polyhedron planeCount=" + triangleCount + " nPoints="
+          + nPoints);
       for (int i = 0; i < triangleCount; i++)
-        Logger.info("Polyhedron " + PT.toJSON("face[" +i + "]", triangles[i]));
+        Logger.info("Polyhedron " + PT.toJSON("face[" + i + "]", 
triangles[i]));
     }
     //System.out.println(PT.toJSON(null, htEdgeMap));
-    return new Polyhedron().set(thisID, modelIndex, atomOrPt, points, nPoints, 
vertexCount,
-        triangles, triangleCount, getFaces(triangles, triangleCount, 
htNormMap), normals, bsCenterPlanes, collapsed, distanceRef);
+    return new Polyhedron().set(thisID, modelIndex, atomOrPt, points, nPoints,
+        vertexCount, triangles, triangleCount,
+        getFaces(triangles, triangleCount, htNormMap), normals, bsCenterPlanes,
+        collapsed, distanceRef);
   }
   
   /**

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-10-30 
12:08:02 UTC (rev 20852)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-11-01 
18:15:50 UTC (rev 20853)
@@ -32,7 +32,7 @@
   Map<String, Object> info;
 
   public String id;
-  P3 center;
+  public P3 center;
 
   public Atom centralAtom;
   public P3[] vertices;
@@ -66,6 +66,8 @@
   public int modelIndex = Integer.MIN_VALUE;
 
   private P3 offset;
+
+  public float scale = 1;
   
 
   Polyhedron() {  
@@ -109,6 +111,8 @@
         colixEdge = C.getColixS(info.get("colorEdge").asString());
         if (info.containsKey("offset"))
           offset = P3.newP(SV.ptValue(info.get("offset")));
+        if (info.containsKey("scale"))
+          scale = SV.fValue(info.get("scale"));
       }
       Lst<SV> lst = info.get("vertices").getList();
       SV vc = info.get("vertexCount");
@@ -220,6 +224,8 @@
       info.put("colorEdge", C.getHexCode(colixEdge == 0 ? colix : colixEdge));
       if (offset != null)
         info.put("offset", offset);
+      if (scale != 1)
+        info.put("scale", Float.valueOf(scale));
     }
     if (faces != null)
       info.put("faces", faces);

Modified: trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java        2015-10-30 
12:08:02 UTC (rev 20852)
+++ trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java        2015-11-01 
18:15:50 UTC (rev 20853)
@@ -764,6 +764,8 @@
   }
 
   protected void slabPolygons(Object[] slabInfo) {
+    thisMesh.calculatedVolume = null;
+    thisMesh.calculatedArea = null;
     thisMesh.getMeshSlicer().slabPolygons(slabInfo, false);
     thisMesh.reinitializeLightingAndColor(vwr);
   }

Modified: trunk/Jmol/src/org/jmol/util/MeshSlicer.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/MeshSlicer.java        2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/util/MeshSlicer.java        2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -583,7 +583,7 @@
     if (iD == i2 && iE == i3) {
       // cap but don't toss if tossing 23
       doClear = !toss23;
-      return false;
+      return !doClear; // was FALSE, but we need to recreate the edge
     }
     if (iD == i1 || iE == i1) {
       // other is i2 or i3 -- along an edge

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -62,8 +62,16 @@
 
 TODO: consider if models with no atoms will cause issues in relation to 
model.firstAtomIndex
 
-Jmol.___JmolVersion="14.5.0_2015.10.30"
+Jmol.___JmolVersion="14.5.0_2015.11.01"
 
+new feature: polyhedra ID xxx SCALE x.x
+  -- ID named polyhedra only
+  -- x.x is the scaling factor, initially 1 
+  -- x.x < 0 does "explode" from {0 0 0} (for higher-order Brillouin zones, 
for instance)
+  -- x.x > 0 does normal scaling
+bug fix: slabbing should reset area and volume of isosurface
+bug fix: meshSlicer may fail to add edge to sliced pmesh
+ 
 FEATURE CHANGE: (Application only for now) PDB default for =xxxx 
   -- changed to 
     "pdb", 
"http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz";
@@ -76,7 +84,7 @@
 new feature: POLYHEDRON ID "xxx" OFFSET {3 3 3}
  -- allows cartesian offset of named polyhedra
  
-bug fix: empty format crashes Jmol --  print "testing".format("")
+bug fix: bug fix: empty format crashes Jmol --  print "testing".format("")
 bug fix: polyhedron volume will be incorrect if there is a 
          face triangle that has no edges visible (requires a six or more sided 
face)  
 

Modified: trunk/Jmol/src/org/jmol/viewer/ShapeManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/ShapeManager.java    2015-10-30 12:08:02 UTC 
(rev 20852)
+++ trunk/Jmol/src/org/jmol/viewer/ShapeManager.java    2015-11-01 18:15:50 UTC 
(rev 20853)
@@ -217,6 +217,7 @@
     JC.SHAPE_ECHO, 
     JC.SHAPE_CONTACT,
     JC.SHAPE_ISOSURFACE,
+    JC.SHAPE_PMESH,
     JC.SHAPE_DRAW,
     JC.SHAPE_FRANK,
   };

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


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to