From: Miguel <mig...@us...> - 2005-09-20 16:04:57
|
Update of /cvsroot/jmol/Jmol/src/org/jmol/viewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23282/src/org/jmol/viewer Modified Files: Sasurface1.java SasurfaceRenderer.java Log Message: sasurface fiddling Index: Sasurface1.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/Sasurface1.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- Sasurface1.java 20 Sep 2005 13:04:18 -0000 1.30 +++ Sasurface1.java 20 Sep 2005 16:04:43 -0000 1.31 @@ -502,16 +502,18 @@ int[] bmpNotClipped; void findClippedGeodesicEdge(boolean isEdgeA, - Point3f geodesicCenter, float radius, - Point3f planeCenter, Vector3f unitNormal, - int[] edgeVertexMap) { + Point3f geodesicCenter, float radius, + Point3f planeCenter, Vector3f unitNormal, + int[] visibleVertexMap, + int[] edgeVertexMap) { if (bmpNotClipped == null) bmpNotClipped = Bmp.allocateBitmap(geodesicVertexCount); else Bmp.clearBitmap(bmpNotClipped); Bmp.clearBitmap(edgeVertexMap); int unclippedCount = 0; - for (int i = geodesicVertexCount; --i >= 0; ) { + for (int i = -1; (i = Bmp.nextSetBit(visibleVertexMap, i + 1)) >= 0; ) { + // for (int i = geodesicVertexCount; --i >= 0; ) { vertexPointT.scaleAdd(radius, geodesicVertexVectors[i], geodesicCenter); vertexVectorT.sub(vertexPointT, planeCenter); @@ -541,6 +543,23 @@ } } } + + int findGeodesicEdge(int[] visibleVertexMap, int[] edgeVertexMap) { + int edgeVertexCount = 0; + Bmp.clearBitmap(edgeVertexMap); + for (int v = -1; (v = Bmp.nextSetBit(visibleVertexMap, v + 1)) >= 0; ) { + int neighborsOffset = v * 6; + for (int j = (v < 12) ? 5 : 6; --j >= 0; ) { + int neighbor = geodesicNeighborVertexes[neighborsOffset + j]; + if (! Bmp.getBit(visibleVertexMap, neighbor)) { + Bmp.setBit(edgeVertexMap, v); + ++edgeVertexCount; + break; + } + } + } + return edgeVertexCount; + } /* * only a small piece of the sphere is clipped. @@ -1083,6 +1102,8 @@ c = (c + 1) & 0xFE; if (c > OUTER_TORUS_STEP_COUNT) c = OUTER_TORUS_STEP_COUNT; + else if (c == 0) + c = 2; int t = 0; for (int i = torusSegmentCount; --i >= 0; ) @@ -1091,10 +1112,23 @@ segmentStripCount = (byte)t; outerPointCount = (byte)c; totalPointCount = (short)(t * c); - // System.out.println("calcPointCounts: " + - // " segmentStripCount=" + segmentStripCount + - // " outerPointCount=" + outerPointCount + - // " totalPointCount=" + totalPointCount); + if (totalPointCount == 0) { + System.out.println("?Que? why is this a torus?"); + System.out.println("calcPointCounts: " + + " outerAngle=" + outerAngle + + " segmentStripCount=" + segmentStripCount + + " outerPointCount=" + outerPointCount + + " totalPointCount=" + totalPointCount); + for (int i = 0; i < torusSegmentCount; ++i) { + TorusSegment ts = torusSegments[i]; + System.out.println(" torusSegment[" + i + "] : " + + " .startAngle=" + ts.startAngle + + " .stepAngle=" + ts.stepAngle + + " .stepCount=" + ts.stepCount); + + } + throw new NullPointerException(); + } } void transformOuterRadials() { @@ -1522,13 +1556,10 @@ Atom atom = frame.atoms[ix]; float atomRadius = atom.getVanderwaalsRadiusFloat(); Point3f atomCenter = atom.point3f; - calcZeroAndCenterPoints(isEdgeA, atomCenter, zeroPointT, centerPointT); - findClippedGeodesicEdge(isEdgeA, atomCenter, atomRadius, - centerPointT, axisUnitVector, - edgeVertexesT); - Bmp.and(edgeVertexesT, convexVertexMaps[ix]); boolean dump = (ixA == 0 && (ixB == 1 || ixB == 3)); - if (Bmp.countBits(edgeVertexesT) > 0) { + int edgeCount = findGeodesicEdge(convexVertexMaps[ix], edgeVertexesT); + if (edgeCount > 0) { + calcZeroAndCenterPoints(isEdgeA, atomCenter, zeroPointT, centerPointT); projectAndSortGeodesicPoints(atomCenter, atomRadius, centerPointT, axisUnitVector, zeroPointT, edgeVertexesT, dump); @@ -1585,12 +1616,19 @@ findClippedGeodesicEdge(true, atomA.point3f, atomA.getVanderwaalsRadiusFloat(), centerPointAT, axisUnitVector, + convexVertexMaps[ixA], edgeVertexesA); findClippedGeodesicEdge(false, atomB.point3f, atomB.getVanderwaalsRadiusFloat(), centerPointBT, axisUnitVector, + convexVertexMaps[ixA], edgeVertexesB); } + + void findEdgeVertexes(int[] edgeVertexesA, int[] edgeVertexesB) { + findGeodesicEdge(convexVertexMaps[ixA], edgeVertexesA); + findGeodesicEdge(convexVertexMaps[ixB], edgeVertexesB); + } } void allocateConvexVertexBitmap(int atomIndex) { Index: SasurfaceRenderer.java =================================================================== RCS file: /cvsroot/jmol/Jmol/src/org/jmol/viewer/SasurfaceRenderer.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- SasurfaceRenderer.java 20 Sep 2005 01:38:36 -0000 1.21 +++ SasurfaceRenderer.java 20 Sep 2005 16:04:43 -0000 1.22 @@ -215,7 +215,7 @@ edgeVertexesAT = Bmp.allocateBitmap(maxVertexCount); edgeVertexesBT = Bmp.allocateBitmap(maxVertexCount); } - torus.findClippedEdgeVertexes(edgeVertexesAT, edgeVertexesBT); + torus.findEdgeVertexes(edgeVertexesAT, edgeVertexesBT); int ixA = torus.ixA; int ixB = torus.ixB; Atom atomA = frame.atoms[ixA]; |