From: <ha...@us...> - 2006-04-24 21:52:30
|
Revision: 5011 Author: hansonr Date: 2006-04-24 14:52:03 -0700 (Mon, 24 Apr 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5011&view=rev Log Message: ----------- IGNORE IGNORE IGNORE -- bob200603 only -- done experimenting with fractal geodesics about as far as I want to go with this. Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/viewer/Dots.java branches/bob200603/Jmol/src/org/jmol/viewer/DotsRenderer.java Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Dots.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Dots.java 2006-04-24 13:03:21 UTC (rev 5010) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Dots.java 2006-04-24 21:52:03 UTC (rev 5011) @@ -532,16 +532,17 @@ // I'd really like to use fractals here... int nPoints = 0; - out: for (int iDot = geodesicSolventCount; --iDot >= 0;) { + for (int iDot = geodesicSolventCount; --iDot >= 0;) { vectorT.set(geodesicSolventVertices[iDot]); if (solventNormal.angle(vectorT) > angleMax) continue; vectorT.scale(r); if (! isInTriangle(vectorT, atomVector[0], atomVector[1], atomVector[2])) - continue out; + continue; setBit(geodesicSolventMap, iDot); nPoints++; } + int[] map = mapNull; int count = getMapStorageCount(geodesicSolventMap); if (count > 0) { @@ -767,16 +768,12 @@ dotsConvexMaps[indexI] = map; } - Point3f T1 = new Point3f(); - Point3f T2 = new Point3f(); - Point3f T3 = new Point3f(); Point3f centerT; - - void calcConvexBitsTEST() { + void calcConvexBits() { + setAllBits(geodesicMap, geodesicCount); if (neighborCount == 0) return; - int[] faceTest = new int[20]; - setAllBits(geodesicMap, geodesicCount); + int faceTest; float combinedRadii = radiusI + radiusP; int p1, p2, p3; short[] faces = dotsRenderer.geodesic.faceIndices; @@ -798,22 +795,22 @@ * -- Bob Hanson * */ - out: for (int f = 0; f < 20; f++) { + Point3f[] vertexTest = dotsRenderer.vertexTest; + for (int i = 0; i < 12; i++) { + vertexTest[i].set(geodesicVertices[i]); + vertexTest[i].scaleAdd(combinedRadii, centerI); + } + for (int f = 0; f < 20; f++) { + faceTest = 0; p1 = faces[3 * p4 * (4 * f + 0)]; p2 = faces[3 * p4 * (4 * f + 1)]; p3 = faces[3 * p4 * (4 * f + 2)]; - T1.set(geodesicVertices[p1]); - T1.scaleAdd(combinedRadii, centerI); - T2.set(geodesicVertices[p2]); - T2.scaleAdd(combinedRadii, centerI); - T3.set(geodesicVertices[p3]); - T3.scaleAdd(combinedRadii, centerI); for (int j = 0; j < neighborCount; j++) { float maxDist = neighborPlusProbeRadii2[j]; centerT = neighborCenters[j]; - ok1 = T1.distanceSquared(centerT) >= maxDist; - ok2 = T2.distanceSquared(centerT) >= maxDist; - ok3 = T3.distanceSquared(centerT) >= maxDist; + ok1 = vertexTest[p1].distanceSquared(centerT) >= maxDist; + ok2 = vertexTest[p2].distanceSquared(centerT) >= maxDist; + ok3 = vertexTest[p3].distanceSquared(centerT) >= maxDist; if (!ok1) clearBit(geodesicMap, p1); if (!ok2) @@ -821,7 +818,7 @@ if (!ok3) clearBit(geodesicMap, p3); if (!ok1 && !ok2 && !ok3) { - faceTest[f] = -1; + faceTest = -1; break; } } @@ -831,7 +828,7 @@ int vect = faces[k]; if (getBit(mapT, vect) || ! getBit(geodesicMap, vect)) continue; - switch (faceTest[f]) { + switch (faceTest) { case -1: clearBit(geodesicMap, vect); break; @@ -853,7 +850,7 @@ } } - void calcConvexBits() { + void calcConvexBitsOLD() { setAllBits(geodesicMap, geodesicCount); if (neighborCount == 0) return; Modified: branches/bob200603/Jmol/src/org/jmol/viewer/DotsRenderer.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/DotsRenderer.java 2006-04-24 13:03:21 UTC (rev 5010) +++ branches/bob200603/Jmol/src/org/jmol/viewer/DotsRenderer.java 2006-04-24 21:52:03 UTC (rev 5011) @@ -34,22 +34,40 @@ int scalePixelsPerAngstrom; boolean bondSelectionModeOr; - Geodesic geodesic, geodesicSolvent; + Geodesic geodesic, geodesicSolvent, g1, g2; final static int[] mapNull = Dots.mapNull; + final Point3f[] vertexTest = new Point3f[12]; + final Vector3f[] vectorTest = new Vector3f[12]; + void initRenderer() { - this.geodesic = new Geodesic(); // 12 vertices + //level = 3 for both + + geodesic = new Geodesic(); // 12 vertices geodesic.quadruple(); // 12 * 4 - 6 = 42 vertices geodesic.quadruple(); // 42 * 4 - 6 = 162 vertices geodesic.quadruple(); // 162 * 4 - 6 = 642 vertices - this.geodesicSolvent = new Geodesic(); // 12 vertices + geodesicSolvent = new Geodesic(); // 12 vertices geodesicSolvent.quadruple(); // 12 * 4 - 6 = 42 vertices geodesicSolvent.quadruple(); // 42 * 4 - 6 = 162 vertices geodesicSolvent.quadruple(); // 162 * 4 - 6 = 642 vertices //geodesicSolvent.quadruple(); // 642 * 4 - 6 + + //these next two are for the geodesic fragment at a distance + g1 = new Geodesic(); // 12 vertices + g1.quadruple(); // 12 * 4 - 6 = 42 vertices + + g2 = new Geodesic(); // 12 vertices + g2.quadruple(); // 12 * 4 - 6 = 42 vertices + g2.quadruple(); // 42 * 4 - 6 = 162 vertices + + for(int i = 0; i < 12; i++) + vertexTest[i] = new Point3f(); + for(int i = 0; i < 12; i++) + vectorTest[i] = new Vector3f(); } void render() { @@ -75,8 +93,8 @@ if (atom.isShapeVisible(myVisibilityFlag)) { renderConvex(dots, atom, colixesConvex[i], dotsConvexMaps[i], iShowSolid, isInMotion); - if (dots.useBobsAlgorithm && !isInMotion) - renderSolventSurface(dots, atoms, colixesConvex, i, iShowSolid); + if (dots.useBobsAlgorithm) + renderSolventSurface(dots, atoms, colixesConvex, i, iShowSolid, isInMotion); } } @@ -116,7 +134,8 @@ if (geodesic.screenCoordinateCount == 0) return; if (iShowSolid && !isInMotion) { - renderGeodesicFragment(colix, geodesic, visibilityMap, mapAtoms); + colix = Graphics3D.GRAY; //for now + renderGeodesicFragment(colix, geodesic, visibilityMap, mapAtoms, geodesic.screenDotCount); } else { g3d.plotPoints(colix, geodesic.screenCoordinateCount, geodesic.screenCoordinates); @@ -127,7 +146,7 @@ Point3i[] screen2; void renderSolventSurface(Dots dots, Atom[] atoms, short[] colixes, int atomIndex, - boolean iShowSolid) { + boolean iShowSolid, boolean isInMotion) { geodesicSolvent.transform(); int nSolventArcs = dots.nSolventArcs[atomIndex]; Dots.SolventArc[] solventArcs = dots.solventArcs[atomIndex]; @@ -153,7 +172,10 @@ viewer.transformPoint(solventArcs[i].center, screen); g3d.fillSphereCentered(Graphics3D.WHITE, 5, screen); } + if(isInMotion) + continue; if (iShowSolid) { + colix1 = colix2 = Graphics3D.GRAY; if (i < nSolventArcs - 1) renderTorusFragment(solventArcs[i], solventArcs[i+1], nArcPoints, colix1, colix2); } else { @@ -188,6 +210,9 @@ .transformPoint(p.atomContact[j])); } } + + if(isInMotion) + continue; //this next call sets the geodesic screenCenterXYZ //and scaledRadius for renderGeodesicFragment geodesicSolvent.calcScreenPoints(p.geodesicPoints, dots.radiusP @@ -195,7 +220,7 @@ if (geodesicSolvent.screenCoordinateCount == 0) continue; if (iShowSolid) { - renderGeodesicFragment(color, geodesicSolvent, p.geodesicPoints, map); + renderGeodesicFragment(Graphics3D.GRAY, geodesicSolvent, p.geodesicPoints, map, geodesicSolvent.screenDotCount); } else { g3d.plotPoints(color, geodesicSolvent.screenCoordinateCount, geodesicSolvent.screenCoordinates); @@ -235,24 +260,30 @@ Point3i facePt2 = new Point3i(); Point3i facePt3 = new Point3i(); - void renderGeodesicFragment(short colix, Geodesic g, int[] points, int[] map) { - short[] faces = g.faceIndices; + void renderGeodesicFragment(short colix, Geodesic g, int[] points, int[] map, + int dotCount) { + short[] faces = (g.screenLevel == 1 ? g1.faceIndices + : g.screenLevel == 2 ? g2.faceIndices : g.faceIndices); int[] coords = g.screenCoordinates; short p1, p2, p3; - int maxPt = ((points.length) << 5); + int mapMax = (points.length << 5); + //System.out.println("geod frag "+mapMax+" "+dotCount); + if (dotCount < mapMax) + mapMax = dotCount; for (int f = 0; f < faces.length;) { p1 = faces[f++]; p2 = faces[f++]; p3 = faces[f++]; - if (p1 >= maxPt || p2 >= maxPt || p3 >= maxPt) + if (p1 >= mapMax || p2 >= mapMax || p3 >= mapMax) continue; - if (! Dots.getBit(points, p1) || ! Dots.getBit(points, p2) - || ! Dots.getBit(points, p3)) + //System.out.println("geod frag "+p1+" "+p2+" "+p3+" "+dotCount); + if (!Dots.getBit(points, p1) || !Dots.getBit(points, p2) + || !Dots.getBit(points, p3)) continue; facePt1.set(coords[map[p1]], coords[map[p1] + 1], coords[map[p1] + 2]); facePt2.set(coords[map[p2]], coords[map[p2] + 1], coords[map[p2] + 2]); facePt3.set(coords[map[p3]], coords[map[p3] + 1], coords[map[p3] + 2]); - g3d.fillTriangle(colix, facePt1, facePt2, facePt3); + g3d.fillTriangle(colix, facePt1, facePt2, facePt3); } } @@ -478,7 +509,6 @@ * shading of dot surfaces. ****************************************************************/ - class Geodesic { void checkVertices() { @@ -562,23 +592,31 @@ } float scaledRadius; + int screenLevel; + int screenDotCount; int screenCenterX, screenCenterY, screenCenterZ; void calcScreenPoints(int[] visibilityMap, float radius, int x, int y, int z, int[] coordMap) { int dotCount = 12; + screenLevel = 3; if (scalePixelsPerAngstrom > 5) { dotCount = 42; + screenLevel = 1; if (scalePixelsPerAngstrom > 10) { dotCount = 162; + screenLevel = 2; if (scalePixelsPerAngstrom > 20) { dotCount = 642; - // if (scalePixelsPerAngstrom > 32) + screenLevel = 3; + // if (scalePixelsPerAngstrom > 32) { + // screenLevel = 4; //untested // dotCount = 2562; + // } } } } - + screenDotCount = dotCount; screenCenterX = x; screenCenterY = y; screenCenterZ = z; @@ -700,6 +738,18 @@ vertices[iVertexNew] = vertexNew; return iVertexNew++; } + + String showMap(int[] map) { + String s = "showMap"; + int n = 0; + int iDot = map.length << 5; + while (--iDot >= 0) + if (getBit(map, iDot)) + s += " " + iDot; + s = n + " points:" + s; + return s; + } + } /* private final static int[] allocateBitmap(int count) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |