From: <ha...@us...> - 2011-03-10 02:01:36
|
Revision: 15265 http://jmol.svn.sourceforge.net/jmol/?rev=15265&view=rev Author: hansonr Date: 2011-03-10 02:01:26 +0000 (Thu, 10 Mar 2011) Log Message: ----------- version=12.1.39_dev # new feature draw ARROW..... BARB # -- fish-hook "radical" arrows # -- included in POVRAY exporter only Modified Paths: -------------- trunk/Jmol/src/org/jmol/export/Export3D.java trunk/Jmol/src/org/jmol/export/_PovrayExporter.java trunk/Jmol/src/org/jmol/export/_TachyonExporter.java trunk/Jmol/src/org/jmol/export/__CartesianExporter.java trunk/Jmol/src/org/jmol/export/__RayTracerExporter.java trunk/Jmol/src/org/jmol/export/___Exporter.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/export/Export3D.java =================================================================== --- trunk/Jmol/src/org/jmol/export/Export3D.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/Export3D.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -518,13 +518,13 @@ // dipole, vector, draw arrow/vector ptA.set(pointBase.x, pointBase.y, pointBase.z); ptB.set(screenTip.x, screenTip.y, screenTip.z); - fillConeSceen(endcap, screenDiameter, ptA, ptB); + exporter.fillConeScreen(colix, endcap, screenDiameter, ptA, ptB, isBarb); } public void fillConeSceen(byte endcap, int screenDiameter, Point3f pointBase, Point3f screenTip) { // cartoons, rockets - exporter.fillConeScreen(colix, endcap, screenDiameter, pointBase, screenTip); + exporter.fillConeScreen(colix, endcap, screenDiameter, pointBase, screenTip, false); } public void drawHermite(int tension, Point3i s0, Point3i s1, Point3i s2, Modified: trunk/Jmol/src/org/jmol/export/_PovrayExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_PovrayExporter.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/_PovrayExporter.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -31,10 +31,12 @@ import java.util.Map; import javax.vecmath.Point3f; +import javax.vecmath.Point4f; import javax.vecmath.Tuple3f; import javax.vecmath.Vector3f; import org.jmol.g3d.Graphics3D; +import org.jmol.util.Measure; import org.jmol.viewer.Viewer; /* @@ -176,8 +178,6 @@ writeMacrosFinish(); writeMacrosAtom(); writeMacrosBond(); - writeMacrosTriangle(); - writeMacrosTextPixel(); // writeMacrosRing(); } @@ -257,7 +257,10 @@ } - private void writeMacrosTriangle() { + private boolean haveMacros; + + private void writeMacros2() { + // triangle output("#macro r(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,R,G,B,T)\n" + " triangle{<X1,Y1,Z1>,<X2,Y2,Z2>,<X3,Y3,Z3>\n" + " pigment{rgbt<R,G,B,T>}\n" @@ -265,27 +268,31 @@ + " clip()\n" + " check_shadow()}\n" + "#end\n\n"); - } - - private void writeMacrosTextPixel() { + // text pixel output("#macro p(X,Y,Z,R,G,B)\n" + " box{<X,Y,Z>,<X+1,Y+1,Z+1>\n" + " pigment{rgb<R,G,B>}\n" + " clip()\n" + " check_shadow()}\n" + "#end\n\n"); + // draw arrow BARB + output("#macro barb(X1,Y1,Z1,RADIUS1,X2,Y2,Z2,RADIUS2,R,G,B,T,X3,Y3,Z3,W3)\n" + + " cone{<X1,Y1,Z1>,RADIUS1,<X2,Y2,Z2>,RADIUS2\n" + + " pigment{rgbt<R,G,B,T>}\n" + + " translucentFinish(T)\n" + + " clip()\n" + + " clipped_by{plane{<X3,Y3,Z3>,W3}}\n" + + " check_shadow()}\n" + "#end\n\n"); + /* + // This type of ring does not take into account perspective effects! + output("#macro o(X,Y,Z,RADIUS,R,G,B,T)\n" + + " torus{RADIUS,wireRadius pigment{rgbt<R,G,B,T>}\n" + + " translate<X,Z,-Y> rotate<90,0,0>\n" + " check_shadow()}\n" + + "#end\n\n"); + */ + haveMacros = true; } - - /* - private void writeMacrosRing() { - // This type of ring does not take into account perspective effects! - output("#macro o(X,Y,Z,RADIUS,R,G,B,T)\n" - + " torus{RADIUS,wireRadius pigment{rgbt<R,G,B,T>}\n" - + " translate<X,Z,-Y> rotate<90,0,0>\n" + " check_shadow()}\n" - + "#end\n\n"); - } - */ - + private String triad(Tuple3f pt) { if (Float.isNaN(pt.x)) return "0,0,0"; @@ -338,10 +345,22 @@ } @Override - protected void outputCone(Point3f screenBase, Point3f screenTip, float radius, - short colix) { - output("b(" + triad(screenBase) + "," + radius + "," - + triad(screenTip) + ",0" + "," + color4(colix) + ")\n"); + protected void outputCone(Point3f screenBase, Point3f screenTip, + float radius, short colix, boolean isBarb) { + if (isBarb) { + if (!haveMacros) + writeMacros2(); + Point4f plane = new Point4f(); + tempP1.set(screenBase.x, screenTip.y, 12345.6789f); + Measure.getPlaneThroughPoints(screenBase, screenTip, tempP1, tempV1, + tempV2, tempV3, plane); + output("barb(" + triad(screenBase) + "," + radius + "," + + triad(screenTip) + ",0" + "," + color4(colix) + "," + plane.x + "," + + plane.y + "," + plane.z + "," + -plane.w + ")\n"); + } else { + output("b(" + triad(screenBase) + "," + radius + "," + triad(screenTip) + + ",0" + "," + color4(colix) + ")\n"); + } } @Override @@ -495,6 +514,8 @@ @Override protected void outputTextPixel(int x, int y, int z, int argb) { + if (!haveMacros) + writeMacros2(); //text only output("p(" + x + "," + y + "," + z + "," + rgbFractionalFromArgb(argb, ',') + ")\n"); @@ -502,6 +523,8 @@ @Override protected void outputTriangle(Point3f ptA, Point3f ptB, Point3f ptC, short colix) { + if (!haveMacros) + writeMacros2(); //cartoons, mesh, isosurface output("r(" + triad(ptA) + "," + triad(ptB) + "," + triad(ptC) + "," + color4(colix) + ")\n"); Modified: trunk/Jmol/src/org/jmol/export/_TachyonExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/_TachyonExporter.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/_TachyonExporter.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -194,7 +194,7 @@ @Override protected void outputCone(Point3f screenBase, Point3f screenTip, float radius, - short colix) { + short colix, boolean isBarb) { // as mesh, which uses Cartesian coordinates Modified: trunk/Jmol/src/org/jmol/export/__CartesianExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/__CartesianExporter.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/__CartesianExporter.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -233,7 +233,7 @@ @Override void fillConeScreen(short colix, byte endcap, int screenDiameter, - Point3f screenBase, Point3f screenTip) { + Point3f screenBase, Point3f screenTip, boolean isBarb) { viewer.unTransformPoint(screenBase, tempP1); viewer.unTransformPoint(screenTip, tempP2); float radius = viewer.unscaleToScreen(screenBase.z, screenDiameter) / 2; Modified: trunk/Jmol/src/org/jmol/export/__RayTracerExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/__RayTracerExporter.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/__RayTracerExporter.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -77,7 +77,7 @@ abstract protected void outputTriangle(Point3f ptA, Point3f ptB, Point3f ptC, short colix); abstract protected void outputCone(Point3f screenBase, Point3f screenTip, float radius, - short colix); + short colix, boolean isBarb); protected Point3f getScreenNormal(Point3f pt, Vector3f normal, float factor) { if (Float.isNaN(normal.x)) { @@ -137,8 +137,8 @@ @Override void fillConeScreen(short colix, byte endcap, int screenDiameter, Point3f screenBase, - Point3f screenTip) { - outputCone(screenBase, screenTip, screenDiameter / 2f, colix); + Point3f screenTip, boolean isBarb) { + outputCone(screenBase, screenTip, screenDiameter / 2f, colix, isBarb); } @Override Modified: trunk/Jmol/src/org/jmol/export/___Exporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/___Exporter.java 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/export/___Exporter.java 2011-03-10 02:01:26 UTC (rev 15265) @@ -544,7 +544,7 @@ //rockets and dipoles abstract void fillConeScreen(short colix, byte endcap, int screenDiameter, - Point3f screenBase, Point3f screenTip); + Point3f screenBase, Point3f screenTip, boolean isBarb); abstract void drawCylinder(Point3f atom1, Point3f atom2, short colix1, short colix2, byte endcaps, int madBond, int bondOrder); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-03-09 18:19:09 UTC (rev 15264) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-03-10 02:01:26 UTC (rev 15265) @@ -4,7 +4,8 @@ version=12.1.39_dev # new feature draw ARROW..... BARB -# -- "radical" arrows +# -- fish-hook "radical" arrows +# -- included in POVRAY exporter only # bug fix: write JMOL (instead of write xxx.jmol) not implemented # bug fix: Jaguar reader not reading vibrations correctly This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |