Revision: 5252
Author: hansonr
Date: 2006-06-28 18:58:57 -0700 (Wed, 28 Jun 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5252&view=rev
Log Message:
-----------
bob200603 10.x.16b polyhedra face/vertex limits return null indicating "too
complex"
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Polyhedra.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Polyhedra.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Polyhedra.java 2006-06-28
23:30:26 UTC (rev 5251)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Polyhedra.java 2006-06-29
01:58:57 UTC (rev 5252)
@@ -234,9 +234,8 @@
}
}
- final static int MAX_VERTICES = 85;
- final static int MAX_POINTS = 256;
- final static int FACE_COUNT_MAX = 85;
+ final static int MAX_VERTICES = 80;
+ final static int FACE_COUNT_MAX = MAX_VERTICES - 3;
Atom[] otherAtoms = new Atom[MAX_VERTICES];
Polyhedron constructBondsPolyhedron(int atomIndex) {
Atom atom = frame.getAtomAt(atomIndex);
@@ -279,23 +278,9 @@
return validatePolyhedronNew(atom, otherAtomCount, otherAtoms);
}
- short[] normixesT = new short[FACE_COUNT_MAX];
- byte[] planesT = new byte[256];
+ short[] normixesT = new short[MAX_VERTICES];
+ byte[] planesT = new byte[MAX_VERTICES * 3];
-
- void setVisibilityFlags(BitSet bs) {
- /*
- * set all fixed objects visible; others based on model being displayed
note
- * that this is NOT done with atoms and bonds, because they have mads. When
- * you say "frame 0" it is just turning on all the mads.
- */
- for (int i = polyhedronCount; --i >= 0;) {
- Polyhedron p = polyhedrons[i];
- p.visibilityFlags = (p.visible && bs.get(p.centralAtom.modelIndex) ?
myVisibilityFlag : 0);
- }
- }
-
-
Polyhedron validatePolyhedronNew(Atom centralAtom, int vertexCount,
Atom[] otherAtoms) {
Vector3f normal = new Vector3f();
@@ -306,7 +291,7 @@
float distMax = 0;
float dAverage = 0;
- Point3f[] points = new Point3f[MAX_POINTS];
+ Point3f[] points = new Point3f[MAX_VERTICES * 3];
points[ptCenter] = centralAtom.point3f;
otherAtoms[ptCenter] = centralAtom;
for (int i = 0; i < ptCenter; i++) {
@@ -320,7 +305,7 @@
// here we are assuring that at least ONE face is drawn to
// all matching vertices
- while (!isOK) {
+ while (!isOK) {
distMax = dAverage * factor;
for (int i = 0; i < ptCenter; i++)
bs.set(i);
@@ -342,13 +327,15 @@
if (bs.get(i)) {
isOK = false;
factor *= 1.05f;
- System.out.println("maxFactor for "+ptCenter+ " atoms increased to "
+ factor
- + " in order to include " + otherAtoms[i].getIdentity());
+ System.out.println("Polyhedra maxFactor for " + ptCenter
+ + " atoms increased to " + factor + " in order to include "
+ + otherAtoms[i].getIdentity());
break;
}
}
- // simply define a face to be when all three distances
+ // start by defining a face to be when all three distances
// are < MAX_FACTOR * longest central
+ // but if a vertex is missed, then expand the range.
// collapsed trick is that introduce a "simple" atom
// near the center but not quite the center, so that our planes on
// either side of the facet don't overlap. We step out maxFactor * normal
@@ -365,6 +352,14 @@
continue;
g3d.getNormalFromCenter(points[ptCenter], points[i], points[j],
points[k], true, normal);
+ if (planeCount >= FACE_COUNT_MAX) {
+ System.out.println("Polyhedron error: maximum
face("+FACE_COUNT_MAX+")");
+ return null;
+ }
+ if (nPoints >= MAX_VERTICES) {
+ System.out.println("Polyhedron error: maximum vertex
count("+MAX_VERTICES+")");
+ return null;
+ }
if (isCollapsed) {
normal.scale(faceCenterOffset);
points[nPoints] = new Point3f(points[ptCenter]);
@@ -395,10 +390,9 @@
planesT[ipt++] = (byte) k;
normixesT[planeCount++] = g3d.getNormix(normal);
}
- if (planeCount == FACE_COUNT_MAX)
- break out;
}
}
+ //System.out.println("planeCount="+planeCount + " nPoints="+nPoints);
return new Polyhedron(centralAtom, nPoints, planeCount, otherAtoms,
normixesT, planesT);
}
@@ -431,4 +425,15 @@
}
}
+ void setVisibilityFlags(BitSet bs) {
+ /*
+ * set all fixed objects visible; others based on model being displayed
note
+ * that this is NOT done with atoms and bonds, because they have mads. When
+ * you say "frame 0" it is just turning on all the mads.
+ */
+ for (int i = polyhedronCount; --i >= 0;) {
+ Polyhedron p = polyhedrons[i];
+ p.visibilityFlags = (p.visible && bs.get(p.centralAtom.modelIndex) ?
myVisibilityFlag : 0);
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits