Pim, here's a quick read of PovraySaver.java:
public PovraySaver(
JmolViewer viewer, OutputStream out,
boolean allModels, int width, int height) {
}
allModels isn't an option. You would just have them displayed or not.
width, height -- from viewer calls
---------------
public void writeFrame() throws IOException {
}
OK, so you need to split this one into getHeader(), getFooter(), and the
various rendering routines.
---------------
public synchronized void writeFile() {
}
unnecessary
---------------
protected String povrayColor(int argb) {
return "rgb<" +
getRed(argb) + "," +
getGrn(argb) + "," +
getBlu(argb) + ">";
}
make that private
-----------------
void writeMacros() throws IOException {
}
void writeMacrosAtom() throws IOException {
}
void writeMacrosRing() throws IOException {
}
void writeMacrosBond() throws IOException {
}
void writeMacrosDoubleBond() throws IOException {
}
void writeMacrosTripleBond() throws IOException {
}
void writeMacrosHydrogenBond() throws IOException {
}
void writeMacrosAromaticBond() throws IOException {
}
void writeMacrosWire() throws IOException {
}
void writeMacrosDoubleWire() throws IOException {
}
void writeMacrosTripleWire() throws IOException {
}
hmm. You need to think about these. The primitives you will be writing
are simpler -- balls, cylinders, and triangles. Perhaps a
macro for each is OK, but that's up to you.
-----------------
void writeAtom(int modelIndex, int i) throws IOException {
int model = viewer.getAtomModelIndex(i);
if (model != modelIndex) {
return;
}
float radius = (float)viewer.getAtomRadius(i);
if (radius == 0)
return;
transformMatrix.transform(viewer.getAtomPoint3f(i), point1);
float x = (float)point1.x;
float y = (float)point1.y;
float z = (float)point1.z;
int argb = viewer.getAtomArgb(i);
float r = getRed(argb);
float g = getGrn(argb);
float b = getBlu(argb);
out("atom("+x+","+y+","+z+","+radius+","+r+","+g+","+b+")\n");
}
this stuff will be in renderAtom() Is there any need for transforms?
-------------------
void writeBond(int modelIndex, int i) throws IOException {
}
OK, let me take a look at this. I need to fix the other renderers anyway.
---------------------
void writePolymer(int modelIndex, int i) throws IOException {
Point3f[] points = viewer.getPolymerLeadMidPoints(modelIndex, i);
Point3f[] controls = computeControlPoints(points);
if (controls != null) {
out("sphere_sweep {\n");
out(" b_spline\n");
out(" " + controls.length + "\n");
for (int j = 0; j < controls.length; j++) {
Point3f point = controls[j];
transformMatrix.transform(point, point1);
double d = 0.2; //TODO
out(" <" + point1.x + "," + point1.y + "," + point1.z + ">," + d
+ "\n");
}
Color color = Color.BLUE; //TODO
float r = color.getRed() / 255f;
float g = color.getGreen() / 255f;
float b = color.getBlue() / 255f;
out(" pigment{rgb<" + r + "," + g + "," + b + ">}\n");
out("}\n");
}
}
scrap this. We need to write triangles, I think.
--------------------
Point3f[] computeControlPoints(Point3f[] path) {
}
TOTALLY unnecessary -- this is now part of Hermite3D
--------------------
float getRed(int argb) {
return ((argb >> 16) & 0xFF) / 255f;
}
float getGrn(int argb) {
return ((argb >> 8) & 0xFF) / 255f;
}
float getBlu(int argb) {
return (argb & 0xFF) / 255f;
}
I think these are taken care of by Exporter.rgbFractionalFromColix(short
colix, char sep)
------------------
pim schravendijk wrote:
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers