From: Miguel <mig...@us...> - 2005-01-16 16:31:08
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/viewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6237/src/org/jmol/viewer Modified Files: Dots.java Surface.java SurfaceRenderer.java Log Message: initial work on stuface toruses Index: Dots.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/Dots.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Dots.java 18 Nov 2004 20:52:31 -0000 1.1 +++ Dots.java 16 Jan 2005 16:30:56 -0000 1.2 @@ -280,7 +280,7 @@ int[] map = mapNull; if (indexLast >= 0) { int count = indexLast + 1; - map = new int[indexLast + 1]; + map = new int[count]; System.arraycopy(geodesicMap, 0, map, 0, count); } dotsConvexMaps[indexI] = map; Index: Surface.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/Surface.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Surface.java 16 Jan 2005 05:05:05 -0000 1.6 +++ Surface.java 16 Jan 2005 16:30:56 -0000 1.7 @@ -94,9 +94,9 @@ int cavityCount; Cavity[] cavities; int torusCount; - Torus[] tori; + Torus[] toruses; - Hashtable htTori; + Hashtable htToruses; int indexI, indexJ, indexK; Atom atomI, atomJ, atomK; @@ -126,8 +126,8 @@ surfaceConvexMax = 0; surfaceConvexMaps = null; torusCount = 0; - htTori = null; - tori = null; + htToruses = null; + toruses = null; cavityCount = 0; cavities = null; radiusP = viewer.getCurrentSolventProbeRadius(); @@ -139,8 +139,8 @@ for (int i = atomCount; --i >= 0; ) if (bsSelected.get(i)) surfaceConvexMaps[i] = null; - deleteUnnecessaryTori(); - deleteUnnecessaryCavities(); + deleteUnusedToruses(); + deleteUnusedCavities(); } // now, calculate surface for selected atoms if (mad != 0) { @@ -153,7 +153,7 @@ setAtomI(i); getNeighbors(bsSelected); calcConvexMap(); - calcTori(); + calcToruses(); calcCavities(); } } @@ -188,7 +188,7 @@ if ("colorSaddle" == propertyName) { short colix = g3d.getColix(value); for (int i = torusCount; --i >= 0; ) { - Torus torus = tori[i]; + Torus torus = toruses[i]; if (bs.get(torus.indexII)) torus.colixI = colix; if (bs.get(torus.indexJJ)) @@ -219,7 +219,7 @@ } } for (int i = torusCount; --i >= 0; ) { - Torus torus = tori[i]; + Torus torus = toruses[i]; if (bs.get(torus.indexII)) torus.colixI = viewer.getColixAtomPalette(atoms[torus.indexII], palette); @@ -280,7 +280,7 @@ int[] map = mapNull; if (indexLast >= 0) { int count = indexLast + 1; - map = new int[indexLast + 1]; + map = new int[count]; System.arraycopy(geodesicMap, 0, map, 0, count); } surfaceConvexMaps[indexI] = map; @@ -362,13 +362,14 @@ */ } - void calcTori() { + void calcToruses() { + System.out.println("calcToruses! radiusP=" + radiusP); if (radiusP == 0) return; - if (htTori == null) { + if (htToruses == null) { torusCount = 0; - tori = new Torus[32]; - htTori = new Hashtable(); + toruses = new Torus[32]; + htToruses = new Hashtable(); } for (int iJ = neighborCount; --iJ >= 0; ) { if (indexI >= neighborIndices[iJ]) @@ -377,33 +378,31 @@ torusIJ = getTorus(atomI, atomJ); if (torusIJ == null) continue; - calcTorusProbeMap(torusIJ); - if (torusIJ.probeMap == 0) - continue; - if (torusCount == tori.length) - tori = (Torus[])Util.doubleLength(tori); - tori[torusCount++] = torusIJ; + if (torusCount == toruses.length) + toruses = (Torus[])Util.doubleLength(toruses); + toruses[torusCount++] = torusIJ; } + System.out.println("torusCount=" + torusCount); } - void deleteUnnecessaryTori() { + void deleteUnusedToruses() { boolean torusDeleted = false; for (int i = torusCount; --i >= 0; ) { - Torus torus = tori[i]; + Torus torus = toruses[i]; if (surfaceConvexMaps[torus.indexII] == null && surfaceConvexMaps[torus.indexJJ] == null) { torusDeleted = true; - tori[i] = null; + toruses[i] = null; } } if (torusDeleted) { int iDestination = 0; for (int iSource = 0; iSource < torusCount; ++iSource) { - if (tori[iSource] != null) - tori[iDestination++] = tori[iSource]; + if (toruses[iSource] != null) + toruses[iDestination++] = toruses[iSource]; } for (int i = torusCount; --i >= iDestination; ) - tori[i] = null; + toruses[i] = null; torusCount = iDestination; } } @@ -412,32 +411,6 @@ final Matrix3f matrixT1 = new Matrix3f(); final AxisAngle4f aaT = new AxisAngle4f(); - void calcTorusProbeMap(Torus torus) { - long probeMap = ~0; - - float stepAngle = 2 * (float)Math.PI / 64; - aaT.set(torus.axisVector, 0); - int iLastNeighbor = 0; - for (int a = 64; --a >= 0; ) { - aaT.angle = a * stepAngle; - matrixT.set(aaT); - matrixT.transform(torus.radialVector, pointT); - pointT.add(torus.center); - int iStart = iLastNeighbor; - do { - if (neighbors[iLastNeighbor].atomIndex != torus.indexJJ) { - if (pointT.distanceSquared(neighborCenters[iLastNeighbor]) - < neighborPlusProbeRadii2[iLastNeighbor]) { - probeMap &= ~(1L << (63 - a)); - break; - } - } - iLastNeighbor = (iLastNeighbor + 1) % neighborCount; - } while (iLastNeighbor != iStart); - } - torus.probeMap = probeMap; - } - final Vector3f vectorT = new Vector3f(); final Vector3f vectorT1 = new Vector3f(); final Vector3f vectorZ = new Vector3f(0, 0, 1); @@ -457,7 +430,6 @@ Vector3f tangentVector; Vector3f outerRadial; float outerAngle; - long probeMap; AxisAngle4f aaRotate; short colixI, colixJ; @@ -535,7 +507,7 @@ if (indexI >= indexJ) throw new NullPointerException(); Long key = new Long(((long)indexI << 32) + indexJ); - Object value = htTori.get(key); + Object value = htToruses.get(key); if (value != null) { if (value instanceof Torus) { Torus torus = (Torus)value; @@ -545,12 +517,12 @@ } float radius = calcTorusRadius(); if (radius == 0) { - htTori.put(key, Boolean.FALSE); + htToruses.put(key, Boolean.FALSE); return null; } Point3f center = calcTorusCenter(); Torus torus = new Torus(centerI, indexI, centerJ, indexJ, center, radius); - htTori.put(key, torus); + htToruses.put(key, torus); return torus; } @@ -606,7 +578,7 @@ } } - void deleteUnnecessaryCavities() { + void deleteUnusedCavities() { boolean cavityDeleted = false; for (int i = cavityCount; --i >= 0; ) { Cavity cavity = cavities[i]; Index: SurfaceRenderer.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/SurfaceRenderer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SurfaceRenderer.java 16 Jan 2005 05:05:05 -0000 1.7 +++ SurfaceRenderer.java 16 Jan 2005 16:30:56 -0000 1.8 @@ -75,18 +75,15 @@ renderConvex(atom, colixesConvex[i], map); } } - Surface.Torus[] tori = surface.tori; + Surface.Torus[] toruses = surface.toruses; for (int i = surface.torusCount; --i >= 0; ) { - Surface.Torus torus = tori[i]; + Surface.Torus torus = toruses[i]; if (displayModelIndex < 0 || displayModelIndex == atoms[torus.indexII].modelIndex) renderTorus(torus, atoms, colixesConvex, surfaceConvexMaps); } + Surface.Cavity[] cavities = surface.cavities; - if (false) { - System.out.println("concave surface rendering currently disabled"); - return; - } for (int i = surface.cavityCount; --i >= 0; ) { Surface.Cavity cavity = cavities[i]; if (displayModelIndex < 0 || @@ -153,8 +150,6 @@ void renderTorus(Surface.Torus torus, Atom[] atoms, short[] colixes, int[][] surfaceConvexMaps) { - if (true) - return; if (surfaceConvexMaps[torus.indexII] != null) renderTorusHalf(torus, getColix(torus.colixI, colixes, atoms, torus.indexII), @@ -175,7 +170,7 @@ void renderTorusHalf(Surface.Torus torus, short colix, boolean renderJHalf) { g3d.setColix(colix); - long probeMap = torus.probeMap; + long probeMap = -1; int torusDotCount1 = (int)(getTorusOuterDotCount() * torus.outerAngle / (2 * Math.PI)); |