From: Miguel <mig...@us...> - 2005-07-16 13:26:07
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/viewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22859/src/org/jmol/viewer Modified Files: Eval.java Volumetric.java Log Message: positive and negative volumetric support Index: Eval.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/Eval.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- Eval.java 16 Jul 2005 00:55:45 -0000 1.44 +++ Eval.java 16 Jul 2005 13:25:53 -0000 1.45 @@ -3451,6 +3451,10 @@ propertyName = "bufferedreader"; propertyValue = t; break; + case Token.decimal: + propertyName = "cutoff"; + propertyValue = statement[i].value; + break; case Token.on: case Token.off: propertyName = (String)statement[i].value; @@ -3462,5 +3466,4 @@ propertyName, propertyValue); } } - } Index: Volumetric.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/Volumetric.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Volumetric.java 16 Jul 2005 12:52:23 -0000 1.14 +++ Volumetric.java 16 Jul 2005 13:25:53 -0000 1.15 @@ -50,7 +50,7 @@ int edgePointCount = 0; Point3f[] edgePoints = new Point3f[256]; - float isoCutoff = 0.02f; + float cutoff = 0.02f; void initShape() { colix = Graphics3D.BLUE; @@ -72,6 +72,9 @@ currentMesh.visible = true; return; } + if ("cutoff" == propertyName) { + cutoff = ((Float)value).floatValue(); + } super.setProperty(propertyName, value, bs); } @@ -254,7 +257,8 @@ float vertexValue = voxelData[x + offset.x][y + offset.y][z + offset.z]; vertexValues[i] = vertexValue; - if (vertexValue >= isoCutoff) + if ((cutoff > 0 && vertexValue >= cutoff) || + (cutoff < 0 && vertexValue <= cutoff)) insideMask |= 1 << i; } @@ -277,7 +281,7 @@ calcVoxelOrigin(x, y, z); int[] voxelPointIndexes = propogateNeighborPointIndexes(x, y, z, isoPointIndexes); - processOneVoxel(insideMask, isoCutoff, voxelPointIndexes); + processOneVoxel(insideMask, cutoff, voxelPointIndexes); } } } @@ -353,7 +357,7 @@ System.out.println(" " + i + ":" + pointIndexes[i]); } - void processOneVoxel(int insideMask, float isoCutoff, + void processOneVoxel(int insideMask, float cutoff, int[] voxelPointIndexes) { int edgeMask = edgeMaskTable[insideMask]; for (int iEdge = 12; --iEdge >= 0; ) { @@ -368,7 +372,7 @@ calcVertexPoints(vertexA, vertexB); addEdgePoint(pointA); addEdgePoint(pointB); - calcSurfacePoint(isoCutoff, valueA, valueB, surfacePoints[iEdge]); + calcSurfacePoint(cutoff, valueA, valueB, surfacePoints[iEdge]); voxelPointIndexes[iEdge] = currentMesh.addVertexCopy(surfacePoints[iEdge]); } @@ -380,13 +384,13 @@ voxelPointIndexes[triangles[i + 2]]); } - void calcSurfacePoint(float isoCutoff, float valueA, float valueB, + void calcSurfacePoint(float cutoff, float valueA, float valueB, Point3f surfacePoint) { float diff = valueB - valueA; - float fraction = (isoCutoff - valueA) / diff; + float fraction = (cutoff - valueA) / diff; if (Float.isNaN(fraction) || fraction < 0 || fraction > 1) { System.out.println("fraction=" + fraction + - " isoCutoff=" + isoCutoff + + " cutoff=" + cutoff + " A:" + valueA + " B:" + valueB); throw new IndexOutOfBoundsException(); |