From: <ha...@us...> - 2006-08-16 08:10:29
|
Revision: 5381 Author: hansonr Date: 2006-08-16 01:10:21 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5381&view=rev Log Message: ----------- bob200603 10.x.44 / 11.0 beta - better precision cylinder vectors http://www.stolaf.edu/people/hansonr/jmol/test/proto/spartan.htm Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/g3d/Cylinder3D.java branches/bob200603/Jmol/src/org/jmol/g3d/Line3D.java Modified: branches/bob200603/Jmol/src/org/jmol/g3d/Cylinder3D.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/g3d/Cylinder3D.java 2006-08-16 06:23:26 UTC (rev 5380) +++ branches/bob200603/Jmol/src/org/jmol/g3d/Cylinder3D.java 2006-08-16 08:10:21 UTC (rev 5381) @@ -185,7 +185,7 @@ } - int xTip, yTip, zTip; + float xTip, yTip, zTip; void renderCone(short colix, byte endcap, int diameter, float xA, float yA, float zA, @@ -196,19 +196,19 @@ this.xA = (int)Math.floor(xAf); this.yA = (int) Math.floor(yAf); this.zA = (int) Math.floor(zAf); - this.dxB = (int)dxBf; - this.dyB = (int)dyBf; - this.dzB = (int)dzBf; - this.xTip = (int)Math.floor(xTip); - this.yTip = (int)Math.floor(yTip); - this.zTip = (int)Math.floor(zTip); + this.dxB = (int) Math.floor(dxBf); + this.dyB = (int) Math.floor(dyBf); + this.dzB = (int) Math.floor(dzBf); + this.xTip = xTip; + this.yTip = yTip; + this.zTip = zTip; this.colixA = colix; this.shadesA = g3d.getShades(colix); this.isScreenedA = (colixA & Graphics3D.TRANSLUCENT_MASK) != 0; int intensityTip = Shade3D.calcIntensity(dxB, dyB, -dzB); - g3d.plotPixelClipped(shadesA[intensityTip], isScreenedA, this.xTip, this.yTip, this.zTip); + g3d.plotPixelClipped(shadesA[intensityTip], isScreenedA, (int)xTip, (int)yTip, (int)zTip); this.diameter = diameter; if (diameter <= 1) { @@ -306,7 +306,7 @@ double z2 = radius2 - (xR * xR + yR * yR); double zR = (z2 > 0 ? Math.sqrt(z2) : 0); -try{ if (isPrecision) { + if (isPrecision) { txRaster[i] = (float) xR; tyRaster[i] = (float) yR; tzRaster[i] = (float) zR; @@ -319,9 +319,6 @@ yRaster[i] = (int) (yR); zRaster[i] = (int) (zR + 0.5); } -}catch (Exception e) { - System.out.println(e); -} fp8IntensityUp[i] = Shade3D.calcFp8Intensity((float) xR, (float) yR, (float) zR); } @@ -528,23 +525,30 @@ } private void plotRasterCone(int i) { - int x = xRaster[i]; - int y = yRaster[i]; - int z = zRaster[i]; - int xUp = xA + x, yUp = yA + y, zUp = zA - z; - int xDn = xA - x, yDn = yA - y, zDn = zA + z; + float x = txRaster[i]; + float y = tyRaster[i]; + float z = tzRaster[i]; + float xUp = xAf + x, yUp = yAf + y, zUp = zAf - z; + float xDn = xAf - x, yDn = yAf - y, zDn = zAf + z; if (tEndcapOpen) { - g3d.plotPixelClipped(argbEndcap, isScreenedA, xUp, yUp, zUp); - g3d.plotPixelClipped(argbEndcap, isScreenedA, xDn, yDn, zDn); + g3d.plotPixelClipped(argbEndcap, isScreenedA, (int) xUp, (int) yUp, + (int) zUp); + g3d.plotPixelClipped(argbEndcap, isScreenedA, (int) xDn, (int) yDn, + (int) zDn); } int fp8Up = fp8IntensityUp[i]; - line3d.plotLineDelta(shadesA, isScreenedA, shadesA, isScreenedA, fp8Up >> 8, - xUp, yUp, zUp, xTip - xUp, yTip - yUp, zTip - zUp, false); - if (! (endcaps == Graphics3D.ENDCAPS_FLAT && dzB > 0)) { + + line3d.plotLineDelta(shadesA, isScreenedA, shadesA, isScreenedA, + fp8Up >> 8, (int) xUp, (int) yUp, (int) zUp, (int) Math.ceil(xTip + - xUp), (int) Math.ceil(yTip - yUp), (int) Math.ceil(zTip - zUp), + false); + + if (!(endcaps == Graphics3D.ENDCAPS_FLAT && dzB > 0)) { int argb = shadesA[0]; - line3d.plotLineDelta(argb, isScreenedA, argb, isScreenedA, - xDn, yDn, zDn, xTip - xDn, yTip - yDn, zTip - zDn, false); + line3d.plotLineDelta(argb, isScreenedA, argb, isScreenedA, (int) xDn, + (int) yDn, (int) zDn, (int) Math.ceil(xTip - xDn), (int) Math + .ceil(yTip - yDn), (int) Math.ceil(zTip - zDn), false); } } Modified: branches/bob200603/Jmol/src/org/jmol/g3d/Line3D.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/g3d/Line3D.java 2006-08-16 06:23:26 UTC (rev 5380) +++ branches/bob200603/Jmol/src/org/jmol/g3d/Line3D.java 2006-08-16 08:10:21 UTC (rev 5381) @@ -579,8 +579,8 @@ roundingFactor = -roundingFactor; int zIncrementScaled = ((dz << 10) + roundingFactor) / dx; int twoDxAccumulatedYError = 0; - int n1 = Math.abs(x2 - x2t) + 1; - int n2 = Math.abs(x2 - x1t) - 1; + int n1 = Math.abs(x2 - x2t);// + 1; + int n2 = Math.abs(x2 - x1t);// - 1; // System.out.println("shade dx-mode n1n2" + " " + n1 + " " + n2 + " xyz " + x // + " " + y + " " + z + " x2 " + (x2) + " y2" + (y2) + " z2 " // + (z + "=z dz= " + dz) + " x2y2t=" + x2t + " " + y2t); @@ -623,8 +623,8 @@ roundingFactor = -roundingFactor; int zIncrementScaled = ((dz << 10) + roundingFactor) / dy; int twoDyAccumulatedXError = 0; - int n1 = Math.abs(y2 - y2t) + 1; - int n2 = Math.abs(y2 - y1t) - 1; + int n1 = Math.abs(y2 - y2t);// + 1; + int n2 = Math.abs(y2 - y1t);// - 1; // System.out.println("shade dy-mode " + " n1=" + n1 + " n2=" + n2 + " xyz " + x // + " " + y + " " + z + " x2 " + (x2) + " y2" + (y2) + " z2 " // + (z + "=z dz= " + dz) + " x2t=" + x2t + " y2t=" + y2t ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |