Revision: 5201
Author: hansonr
Date: 2006-06-05 11:10:37 -0700 (Mon, 05 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5201&view=rev
Log Message:
-----------
bob200603 10.x.10 isosurface
adds: color sign [negative-color] [positive-color]
adds: color phase "[x,y,z,xy,yz,xz,x2-y2,z2]"
May have a mistake in the z2 calc if it node is not at (z^2 - x^2 - y^2 = 0).
Had to modify compiler to allow for multiple [rgb] parameters on a line.
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java
branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java 2006-06-03
18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java 2006-06-05
18:10:37 UTC (rev 5201)
@@ -1606,13 +1606,10 @@
boolean compileColorParam() {
for (int i = 1; i < atokenCommand.length; ++i) {
Token token = atokenCommand[i];
+ System.out.println(token + " atokenCommand: " + atokenCommand.length);
if (token.tok == Token.leftsquare) {
- Token[] atokenNew = new Token[i + 1];
- System.arraycopy(atokenCommand, 0, atokenNew, 0, i);
- if (! compileRGB(atokenCommand, i, atokenNew))
+ if (! compileRGB(i))
return false;
- atokenCommand = atokenNew;
- break;
} else if (token.tok == Token.dollarsign) {
i++; // skip identifier
} else if (token.tok == Token.identifier) {
@@ -1627,9 +1624,10 @@
return true;
}
- boolean compileRGB(Token[] atoken, int i, Token[] atokenNew) {
- if (atoken.length == i + 7 &&
- atoken[i ].tok == Token.leftsquare &&
+ boolean compileRGB(int i) {
+ Token[] atoken = atokenCommand;
+ if (atoken.length >= i + 7 &&
+ atoken[i].tok == Token.leftsquare &&
atoken[i+1].tok == Token.integer &&
atoken[i+2].tok == Token.opOr &&
atoken[i+3].tok == Token.integer &&
@@ -1640,11 +1638,16 @@
atoken[i+1].intValue << 16 |
atoken[i+3].intValue << 8 |
atoken[i+5].intValue);
- atokenNew[i] = new Token(Token.colorRGB, argb, "[R,G,B]");
+ atoken[i++] = new Token(Token.colorRGB, argb, "[R,G,B]");
+ for (int ipt = i+6; ipt < atoken.length; ipt++)
+ atoken[i++] = atoken[ipt];
+ Token[] atokenNew = new Token[i];
+ System.arraycopy(atoken, 0, atokenNew, 0, i);
+ atokenCommand = atokenNew;
return true;
}
// chime also accepts [xRRGGBB]
- if (atoken.length == i + 3 &&
+ if (atoken.length >= i + 3 &&
atoken[i ].tok == Token.leftsquare &&
atoken[i+1].tok == Token.identifier &&
atoken[i+2].tok == Token.rightsquare) {
@@ -1653,7 +1656,12 @@
hex.charAt(0) == 'x') {
try {
int argb = 0xFF000000 | Integer.parseInt(hex.substring(1), 16);
- atokenNew[i] = new Token(Token.colorRGB, argb, "[xRRGGBB]");
+ atoken[i++] = new Token(Token.colorRGB, argb, "[xRRGGBB]");
+ for (int ipt = i+2; ipt < atoken.length; ipt++)
+ atoken[i++] = atoken[ipt];
+ Token[] atokenNew = new Token[i];
+ System.arraycopy(atoken, 0, atokenNew, 0, i);
+ atokenCommand = atokenNew;
return true;
} catch (NumberFormatException e) {
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-03
18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-05
18:10:37 UTC (rev 5201)
@@ -3978,11 +3978,14 @@
void isosurface() throws ScriptException {
int fileIndexPt = 0;
+ int signPt = 0;
int contourPt = 0;
viewer.loadShape(JmolConstants.SHAPE_ISOSURFACE);
viewer.setShapeProperty(JmolConstants.SHAPE_ISOSURFACE, "init", null);
boolean colorSeen = false;
int colorRangeStage = 0;
+ boolean colorByPhase = false;
+
for (int i = 1; i < statementLength; ++i) {
String propertyName = null;
Object propertyValue = null;
@@ -3998,53 +4001,76 @@
propertyName = "background";
propertyValue = Boolean.TRUE;
break;
- case Token.identifier:
- if (((String) token.value).equalsIgnoreCase("fileIndex")) {
+ case Token.colorRGB:
+ if (colorRangeStage == 0 || colorRangeStage >= 3)
+ invalidArgument();
+ if (i != signPt && i != signPt + 1)
+ invalidParameterOrder();
+ propertyName = "colorRGB";
+ propertyValue = new Integer(getArgbParam(i));
+ colorRangeStage++;
+ break;
+ case Token.identifier:
+ String str = (String) token.value;
+ if (str.equalsIgnoreCase("sign")) {
+ signPt = i + 1;
+ propertyName = "sign";
+ propertyValue = Boolean.TRUE;
+ colorRangeStage = 1;
+ break;
+ } else if (str.equalsIgnoreCase("phase")) {
+ colorByPhase = true;
+ break;
+ } else if (str.equalsIgnoreCase("fileIndex")) {
fileIndexPt = i + 1;
break;
- }
- if (((String) token.value).equalsIgnoreCase("noBackground")) {
+ } else if (str.equalsIgnoreCase("noBackground")) {
propertyName = "background";
propertyValue = Boolean.FALSE;
break;
- }
- if (((String) token.value).equalsIgnoreCase("debug")) {
+ } else if (str.equalsIgnoreCase("debug")) {
propertyName = "debug";
propertyValue = Boolean.TRUE;
break;
- }
- if (((String) token.value).equalsIgnoreCase("noDebug")) {
+ } else if (str.equalsIgnoreCase("noDebug")) {
propertyName = "debug";
propertyValue = Boolean.FALSE;
break;
- }
- if (((String) token.value).equalsIgnoreCase("gridPoints")) {
+ } else if (str.equalsIgnoreCase("gridPoints")) {
propertyName = "gridPoints";
break;
- }
- if (((String) token.value).equalsIgnoreCase("contour")) {
+ } else if (str.equalsIgnoreCase("contour")) {
propertyName = "contour";
contourPt = i + 1;
break;
}
propertyValue = token.value;
- //fall through
+ //fall through
case Token.all:
propertyName = "meshID";
break;
case Token.string:
String filename = (String) token.value;
- if (filename.length() == 0)
- filename = viewer.getFullPathName();
- System.out.println("reading isosurface data from " + filename);
- Object t = viewer
- .getUnzippedBufferedReaderOrErrorMessageFromName(filename);
- if (t instanceof String)
- fileNotFoundException(filename + ":" + t);
- propertyName = colorSeen ? "colorReader" : "bufferedReader";
- if (colorSeen && colorRangeStage != 0 && colorRangeStage != 3)
- invalidArgument();
- propertyValue = t;
+ if (colorByPhase) {
+ propertyName = "phase";
+ propertyValue = token.value;
+ } else {
+ if (filename.length() == 0)
+ filename = viewer.getFullPathName();
+ System.out.println("reading isosurface data from " + filename);
+ Object t = viewer
+ .getUnzippedBufferedReaderOrErrorMessageFromName(filename);
+ if (t instanceof String)
+ fileNotFoundException(filename + ":" + t);
+ propertyName = colorSeen ? "colorReader" : "bufferedReader";
+ if (colorSeen && colorRangeStage != 0 && colorRangeStage != 1
+ && colorRangeStage != 3) {
+ System.out.println("color seen, but colorRangeStage = "
+ + colorRangeStage);
+ invalidArgument();
+ }
+ propertyValue = t;
+ }
break;
case Token.decimal:
if (colorRangeStage == 0) {
@@ -4098,6 +4124,7 @@
break;
case Token.color:
colorSeen = true;
+ colorRangeStage = 1;
propertyName = "removeRange";
break;
case Token.absolute:
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-03
18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-05
18:10:37 UTC (rev 5201)
@@ -104,7 +104,16 @@
final static int defaultContourCount = 10;
final static String colorScheme = "roygb";
final static int nContourMax = 100;
+ final static int defaultColorNegative = Graphics3D.getArgbFromString("red");
+ final static int defaultColorPositive = Graphics3D.getArgbFromString("blue");
+ boolean colorBySign;
+ int colorNeg;
+ int colorPos;
+ int colorPtr;
+ boolean colorByPhase;
+ int colorPhase;
+
int edgeFractionBase;
int edgeFractionRange;
int colorFractionBase;
@@ -129,7 +138,7 @@
final Matrix3f volumetricMatrix = new Matrix3f();
float[][][] voxelData;
- int fileIndex = 0; //one-based
+ int fileIndex; //one-based
float cutoff = Float.MAX_VALUE;
boolean rangeDefined;
@@ -168,18 +177,36 @@
thisContour = -1;
iDoContourPlane = true;
datasetIs2dContour = false;
+ colorBySign = false;
+ colorNeg = defaultColorNegative;
+ colorPos = defaultColorPositive;
+ colorByPhase = false;
loadAll = false;
cutoff = Float.MAX_VALUE;
super.setProperty("meshID", null, null);
return;
}
+
+ if ("sign" == propertyName) {
+ colorBySign = true;
+ colorPtr = 0;
+ return;
+ }
+
+ if ("colorRGB" == propertyName) {
+ int rgb = ((Integer) value).intValue();
+ if (colorPtr++ > 0) {
+ colorPos = rgb;
+ } else {
+ colorNeg = rgb;
+ }
+ return;
+ }
+
if ("fileIndex" == propertyName) {
fileIndex = ((Integer) value).intValue();
- loadAll = (fileIndex < 1);
- if (loadAll) {
+ if (fileIndex < 1)
fileIndex = 1;
- //option here to "display all"?
- }
return;
}
@@ -224,6 +251,26 @@
rangeDefined = false;
return;
}
+
+ if ("phase" == propertyName) {
+ colorBySign = true;
+ colorByPhase = true;
+ String color = (String) value;
+ colorPhase = -1;
+ for (int i = colorPhases.length; --i >= 0;)
+ if (color.equalsIgnoreCase(colorPhases[i])) {
+ colorPhase = i;
+ break;
+ }
+ if (colorPhase < 0) {
+ System.out.println(" invalid color phase: " + color);
+ return;
+ }
+ applyColorScale();
+ currentMesh.visible = true;
+ return;
+ }
+
if ("bufferedReader" == propertyName) {
System.out.println("loading voxel data...");
br = (BufferedReader) value;
@@ -293,10 +340,14 @@
}
void setMapRanges() {
+ if (colorByPhase) {
+ mappedDataMin = -1;
+ mappedDataMax = 1;
+ }
if (logMessages)
System.out.println("setMapRanges: all mapped data " + mappedDataMin
- + " - " + mappedDataMax + ", red-blue selected " + valueMappedToRed
- + " - " + valueMappedToBlue);
+ + " to " + mappedDataMax + ", red-blue selected " + valueMappedToRed
+ + " to " + valueMappedToBlue);
if (mappedDataMin == Float.MAX_VALUE || mappedDataMin == mappedDataMax) {
mappedDataMin = getMinMappedValue();
mappedDataMax = getMaxMappedValue();
@@ -608,7 +659,7 @@
*
* a) there's no plane
* b) we need the map data (second pass)
- *
+ *
*/
if (isMapData || thePlane == null)
@@ -687,7 +738,8 @@
iDoContourPlane = false;
thePlane = null;
isJvxlColorPrecision = (nColorData < -1);
- if (nColorData < -1) nColorData = -nColorData;
+ if (nColorData < -1)
+ nColorData = -nColorData;
if (nStructureData < 0) {
if (nEdgeData == -2) {
iDoContourPlane = true; //color data is for the entire grid.
@@ -730,11 +782,11 @@
rangeDefined = true;
} else {
valueMappedToRed = 0f;
- valueMappedToBlue = 1f;
+ valueMappedToBlue = 1f;
rangeDefined = true;
}
- System.out.println("JVXL read: color red/blue: " + valueMappedToRed
- + " " + valueMappedToBlue);
+ System.out.println("JVXL read: color red/blue: " + valueMappedToRed + " "
+ + valueMappedToBlue);
}
}
@@ -943,9 +995,14 @@
setMapRanges();
float min = mappedDataMin;
float max = mappedDataMax;
- System.out.println("full mapped data range: " + min + " - " + max);
- System.out.println("coloring red to blue over range: " + valueMappedToRed
- + " - " + valueMappedToBlue);
+ System.out.println("full mapped data range: " + min + " to " + max);
+ if (colorByPhase)
+ System.out.println("coloring by phase: " + colorPhase);
+ else if (colorBySign)
+ System.out.println("coloring by sign");
+ else
+ System.out.println("coloring red to blue over range: " + valueMappedToRed
+ + " - " + valueMappedToBlue);
if (colixes == null)
mesh.vertexColixes = colixes = new short[vertexCount];
String list = "";
@@ -968,13 +1025,13 @@
+ jvxlValueFromCharacter2(ch, remainder, min, max,
colorFractionBase, colorFractionRange));
} else {
- ch = jvxlValueAsCharacter(value, valueMappedToRed,
valueMappedToBlue, colorFractionBase,
- colorFractionRange);
+ ch = jvxlValueAsCharacter(value, valueMappedToRed, valueMappedToBlue,
+ colorFractionBase, colorFractionRange);
}
list += ch;
}
}
- mesh.jvxlColorData = list + list1 + "\n";
+ mesh.jvxlColorData = (colorByPhase ? "" : list + list1 + "\n");
if (logMessages)
System.out.println("color data: " + mesh.jvxlColorData);
}
@@ -989,29 +1046,57 @@
*
*/
- if (datasetIs2dContour)
+ if (colorByPhase)
+ datum = value = getPhase(mesh.vertices[vertexIndex]);
+ else if (datasetIs2dContour)
datum = value = getInterpolatedPixelValue(mesh.vertices[vertexIndex]);
else
datum = value = lookupInterpolatedVoxelValue(mesh.vertices[vertexIndex]);
- if (value < valueMappedToRed)
- value = valueMappedToRed;
- if (value >= valueMappedToBlue)
- value = valueMappedToBlue;
+ if (colorBySign) {
+ if (value <= 0)
+ mesh.vertexColixes[vertexIndex] = Graphics3D.getColix(colorNeg);
+ if (value > 0)
+ mesh.vertexColixes[vertexIndex] = Graphics3D.getColix(colorPos);
+ } else {
+ if (value < valueMappedToRed)
+ value = valueMappedToRed;
+ if (value >= valueMappedToBlue)
+ value = valueMappedToBlue;
+ mesh.vertexColixes[vertexIndex] = viewer.getColixFromPalette(value,
+ valueMappedToRed, valueMappedToBlue, colorScheme);
+ }
+ //System.out.println("setvertexcolor " + vertexIndex + ": " + datum + " "
+ // + value + " " + mesh.vertexColixes[vertexIndex]);
- /* tried this -- didn't look good:
- * if (value < valueMappedToRed || value >= valueMappedToBlue)
- mesh.vertexColixes[vertexIndex] = 0;
- else
- */
- mesh.vertexColixes[vertexIndex] = viewer.getColixFromPalette(value,
- valueMappedToRed, valueMappedToBlue, colorScheme);
- System.out.println("setvertexcolor " + vertexIndex + ": " + datum + " " +
value + " "
- + mesh.vertexColixes[vertexIndex]);
-
return datum;
}
+ final static String[] colorPhases = { "x", "y", "z", "xy", "yz", "xz",
+ "x2-y2", "z2" };
+
+ float getPhase(Point3f pt) {
+ switch (colorPhase) {
+ case 0:
+ return (pt.x > 0 ? 1 : -1);
+ case 1:
+ return (pt.y > 0 ? 1 : -1);
+ case 2:
+ return (pt.z > 0 ? 1 : -1);
+ case 3:
+ return (pt.x * pt.y > 0 ? 1 : -1);
+ case 4:
+ return (pt.y * pt.z > 0 ? 1 : -1);
+ case 5:
+ return (pt.x * pt.z > 0 ? 1 : -1);
+ case 6:
+ return (pt.x * pt.x - pt.y * pt.y > 0 ? 1 : -1);
+ case 7:
+ return (pt.z * pt.z - pt.x * pt.x - pt.y * pt.y > 0 ? 1 : -1);
+ }
+ return 1;
+ }
+
float getMinMappedValue() {
if (currentMesh != null)
return getMinMappedValue(currentMesh);
@@ -1172,7 +1257,7 @@
mesh.vertexColixes = colixes = new short[vertexCount];
int nDataPoints = (iDoContourPlane ? contourVertexCount : vertexCount);
String data = "";
-
+
data = jvxlReadData(nColorData);
int cpt = 0;
for (int i = 0; i < nDataPoints; i++) {
@@ -1188,8 +1273,8 @@
} else {
// my original encoding scheme
// low precision only allows for mapping relative to the defined color
range
- fraction = jvxlFractionFromCharacter(data.charAt(cpt),
colorFractionBase,
- colorFractionRange, 0.5f);
+ fraction = jvxlFractionFromCharacter(data.charAt(cpt),
+ colorFractionBase, colorFractionRange, 0.5f);
value = valueMappedToRed + fraction * colorRange;
}
++cpt;
@@ -1201,11 +1286,11 @@
if (iDoContourPlane) {
contourVertexes[i].setValue(value);
} else {
- colixes[i] = viewer.getColixFromPalette(value,
- valueMappedToRed, valueMappedToBlue, scaleName);
+ colixes[i] = viewer.getColixFromPalette(value, valueMappedToRed,
+ valueMappedToBlue, scaleName);
if (logMessages)
- System.out.println("readColor " + i + ": " + fraction + " " + value
+ " "
- + valueMappedToRed + " " + valueMappedToBlue + " "
+ System.out.println("readColor " + i + ": " + fraction + " " + value
+ + " " + valueMappedToRed + " " + valueMappedToBlue + " "
+ colixes[i]);
if (mesh.hasGridPoints) {
colixes[++i] = viewer.getColixFromPalette(0.2f, 0f, 1f, scaleName);
@@ -1338,14 +1423,15 @@
+ mesh.jvxlEdgeData + "\n" + mesh.jvxlColorData + "\n"
+ mesh.jvxlPlane);
- if (mesh.jvxlPlane == null) { //no point in compressing this
- compressedData += mesh.jvxlEdgeData + mesh.jvxlColorData;
+ if (mesh.jvxlPlane == null) {
+ //no real point in compressing this unless it's a sign-based coloring
+ compressedData += jvxlCompressString(mesh.jvxlEdgeData
+ + mesh.jvxlColorData);
int nColor = (mesh.jvxlColorData.length() - 1);
- if (isJvxlColorPrecision)
+ if (isJvxlColorPrecision && nColor != -1)
nColor = -nColor;
data += mesh.jvxlSurfaceData.length() + " "
- + (mesh.jvxlEdgeData.length() - 1) + " "
- + nColor;
+ + (mesh.jvxlEdgeData.length() - 1) + " " + nColor;
} else {
data += "-1 -2 " + (1 - mesh.jvxlColorData.length()) + " "
+ mesh.jvxlPlane.x + " " + mesh.jvxlPlane.y + " " + mesh.jvxlPlane.z
@@ -1358,8 +1444,8 @@
data += " CONTOUR PLANE " + mesh.jvxlPlane;
if (!isJvxl)
data += " approximate compressionRatio="
- + (int) (mesh.nBytes * 1f / (data.length() +
compressedData.length()))
- + ":1";
+ + (int) (((float)mesh.nBytes + mesh.jvxlFileHeader.length()) /
+ (data.length() + compressedData.length())) + ":1";
data += "\n" + compressedData;
if (msg != null)
data += "#-------end of jvxl file data-------\n";
@@ -1485,6 +1571,7 @@
contourType = getContourType(thePlane);
contourVertexCount = 0;
}
+ boolean contouring = (thePlane != null && iDoContourPlane);
int[][] isoPointIndexes = new int[cubeCountY * cubeCountZ][12];
for (int i = cubeCountY * cubeCountZ; --i >= 0;)
isoPointIndexes[i] = new int[12];
@@ -1515,7 +1602,7 @@
continue;
}
++surfaceCount;
- processOneVoxel(insideMask, cutoff, voxelPointIndexes, x, y, z);
+ processOneVoxel(insideMask, cutoff, voxelPointIndexes, x, y, z,
contouring);
}
}
}
@@ -1606,7 +1693,7 @@
final static float assocCutoff = 0.3f;
void processOneVoxel(int insideMask, float cutoff, int[] voxelPointIndexes,
- int x, int y, int z) {
+ int x, int y, int z, boolean contouring) {
int edgeMask = insideMaskTable[insideMask];
for (int iEdge = 12; --iEdge >= 0;) {
if ((edgeMask & (1 << iEdge)) == 0)
@@ -1622,9 +1709,9 @@
calcVertexPoints(vertexA, vertexB);
float fraction = calcSurfacePoint(cutoff, valueA, valueB,
surfacePoints[iEdge]);
- if (thePlane != null && iDoContourPlane) {
+ if (contouring) {
// specifically planes being produced NOT from color mapped files
- // for now. No contouring then, but maybe in the future?
+ // for now.
// System.out.println(" processVoxel " + x + "," + y + "," + z + " "
// + iEdge + " " + binaryString(edgeMask) + " " + contourType
// + " fraction " + fraction + " valueA " + valueA + " valueB "
@@ -1646,8 +1733,7 @@
addVertexCopy(valueA < valueB ? pointB : pointA, false, "");
}
}
-
- if (datasetIs2dContour)
+ if (contouring)
return;
byte[] triangles = triangleTable[insideMask];
for (int i = triangles.length; (i -= 3) >= 0;)
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-06-03 18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/JmolConstants.java
2006-06-05 18:10:37 UTC (rev 5201)
@@ -39,7 +39,7 @@
// for now, just update this by hand
// perhaps use ant filter later ... but mth doesn't like it :-(
public final static String copyright = "(C) 2006 Jmol Development";
- public final static String version = "10.x.09(branch bob200603)";
+ public final static String version = "10.x.10(branch bob200603)";
public final static String cvsDate = "$Date$";
public final static String date = cvsDate.substring(7, 23);
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
2006-06-03 18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/MeshRenderer.java
2006-06-05 18:10:37 UTC (rev 5201)
@@ -117,58 +117,58 @@
if (!mesh.isPolygonDisplayable(i))
continue;
int[] vertexIndexes = polygonIndexes[i];
- if (vertexIndexes != null) {
- int iA = vertexIndexes[0];
- int iB = vertexIndexes[1];
- int iC = vertexIndexes[2];
- short colixA, colixB, colixC;
- if (vertexColixes != null) {
- colixA = vertexColixes[iA];
- colixB = vertexColixes[iB];
- colixC = vertexColixes[iC];
- } else {
- colixA = colixB = colixC = colix;
- }
- if (iHideBackground) {
- if (colixA == hideColix && colixB == hideColix && colixC ==
hideColix)
- continue;
- if (colixA == hideColix)
- colixA = backgroundColix;
- if (colixB == hideColix)
- colixB = backgroundColix;
- if (colixC == hideColix)
- colixC = backgroundColix;
- }
- if (iB == iC) {
- g3d.fillCylinder(colixA, Graphics3D.ENDCAPS_SPHERICAL, (iA == iB ? 6
- : 3), screens[iA], screens[iB]);
- } else if (vertexIndexes.length == 3) {
- if (fill)
- if (iShowTriangles)
- g3d.fillTriangleTest(screens[iA], colixA, normixes[iA],
- screens[iB], colixB, normixes[iB], screens[iC], colixC,
- normixes[iC]);
- else
- g3d.fillTriangle(screens[iA], colixA, normixes[iA], screens[iB],
- colixB, normixes[iB], screens[iC], colixC, normixes[iC]);
- else
- // FIX ME ... need a drawTriangle routine with multiple colors
- g3d.drawTriangle(colixA, screens[iA], screens[iB], screens[iC]);
-
- } else if (vertexIndexes.length == 4) {
- int iD = vertexIndexes[3];
- short colixD = vertexColixes != null ? vertexColixes[iD] : colix;
- if (fill)
- g3d.fillQuadrilateral(screens[iA], colixA, normixes[iA],
+ if (vertexIndexes == null)
+ continue;
+ int iA = vertexIndexes[0];
+ int iB = vertexIndexes[1];
+ int iC = vertexIndexes[2];
+ short colixA, colixB, colixC;
+ if (vertexColixes != null) {
+ colixA = vertexColixes[iA];
+ colixB = vertexColixes[iB];
+ colixC = vertexColixes[iC];
+ } else {
+ colixA = colixB = colixC = colix;
+ }
+ if (iHideBackground) {
+ if (colixA == hideColix && colixB == hideColix && colixC == hideColix)
+ continue;
+ if (colixA == hideColix)
+ colixA = backgroundColix;
+ if (colixB == hideColix)
+ colixB = backgroundColix;
+ if (colixC == hideColix)
+ colixC = backgroundColix;
+ }
+ if (iB == iC) {
+ g3d.fillCylinder(colixA, Graphics3D.ENDCAPS_SPHERICAL, (iA == iB ? 6
+ : 3), screens[iA], screens[iB]);
+ } else if (vertexIndexes.length == 3) {
+ if (fill)
+ if (iShowTriangles)
+ g3d.fillTriangleTest(screens[iA], colixA, normixes[iA],
screens[iB], colixB, normixes[iB], screens[iC], colixC,
- normixes[iC], screens[iD], colixD, normixes[iD]);
+ normixes[iC]);
else
- g3d.drawQuadrilateral(colixA, screens[iA], screens[iB],
- screens[iC], screens[iD]);
+ g3d.fillTriangle(screens[iA], colixA, normixes[iA], screens[iB],
+ colixB, normixes[iB], screens[iC], colixC, normixes[iC]);
+ else
+ // FIX ME ... need a drawTriangle routine with multiple colors
+ g3d.drawTriangle(colixA, screens[iA], screens[iB], screens[iC]);
- } else {
- System.out.println("PmeshRenderer: polygon with > 4 sides");
- }
+ } else if (vertexIndexes.length == 4) {
+ int iD = vertexIndexes[3];
+ short colixD = vertexColixes != null ? vertexColixes[iD] : colix;
+ if (fill)
+ g3d.fillQuadrilateral(screens[iA], colixA, normixes[iA], screens[iB],
+ colixB, normixes[iB], screens[iC], colixC, normixes[iC],
+ screens[iD], colixD, normixes[iD]);
+ else
+ g3d.drawQuadrilateral(colixA, screens[iA], screens[iB], screens[iC],
+ screens[iD]);
+
+ } else {
+ System.out.println("PmeshRenderer: polygon with > 4 sides");
}
}
}
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Token.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-06-03
18:16:30 UTC (rev 5200)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-06-05
18:10:37 UTC (rev 5201)
@@ -181,7 +181,7 @@
final static int pmesh = command | 91;
final static int polyhedra = command | 92 | embeddedExpression;
final static int centerAt = command | 93;
- final static int isosurface = command | 94 | negnums | showparam;
+ final static int isosurface = command | 94 | negnums | showparam |
colorparam;
final static int draw = command | 95 | embeddedExpression;
final static int getproperty = command | 96;
final static int dipole = command | 97 | embeddedExpression;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits