src/demo/share/applets/MoleculeViewer/XYZApp.java

Print this page




 487     }
 488 
 489     @Override
 490     public String[][] getParameterInfo() {
 491         String[][] info = {
 492             { "model", "path string", "The path to the model to be displayed"
 493                 + " in .xyz format "
 494                 + "(see http://chem.leeds.ac.uk/Project/MIME.html)."
 495                 + "  Default is model.obj." },
 496             { "scale", "float", "Scale factor.  Default is 1 (i.e. no scale)." }
 497         };
 498         return info;
 499     }
 500 }   // end class XYZApp
 501 
 502 
 503 class Atom {
 504 
 505     private static Applet applet;
 506     private static byte[] data;
 507     private final static int R = 40;
 508     private final static int hx = 15;
 509     private final static int hy = 15;
 510     private final static int bgGrey = 192;
 511     private final static int nBalls = 16;
 512     private static int maxr;
 513     private int Rl;
 514     private int Gl;
 515     private int Bl;
 516     private Image balls[];
 517 
 518     static {
 519         data = new byte[R * 2 * R * 2];
 520         int mr = 0;
 521         for (int Y = 2 * R; --Y >= 0;) {
 522             int x0 = (int) (Math.sqrt(R * R - (Y - R) * (Y - R)) + 0.5);
 523             int p = Y * (R * 2) + R - x0;
 524             for (int X = -x0; X < x0; X++) {
 525                 int x = X + hx;
 526                 int y = Y - R + hy;
 527                 int r = (int) (Math.sqrt(x * x + y * y) + 0.5);
 528                 if (r > mr) {
 529                     mr = r;
 530                 }
 531                 data[p++] = r <= 0 ? 1 : (byte) r;




 487     }
 488 
 489     @Override
 490     public String[][] getParameterInfo() {
 491         String[][] info = {
 492             { "model", "path string", "The path to the model to be displayed"
 493                 + " in .xyz format "
 494                 + "(see http://chem.leeds.ac.uk/Project/MIME.html)."
 495                 + "  Default is model.obj." },
 496             { "scale", "float", "Scale factor.  Default is 1 (i.e. no scale)." }
 497         };
 498         return info;
 499     }
 500 }   // end class XYZApp
 501 
 502 
 503 class Atom {
 504 
 505     private static Applet applet;
 506     private static byte[] data;
 507     private static final int R = 40;
 508     private static final int hx = 15;
 509     private static final int hy = 15;
 510     private static final int bgGrey = 192;
 511     private static final int nBalls = 16;
 512     private static int maxr;
 513     private int Rl;
 514     private int Gl;
 515     private int Bl;
 516     private Image balls[];
 517 
 518     static {
 519         data = new byte[R * 2 * R * 2];
 520         int mr = 0;
 521         for (int Y = 2 * R; --Y >= 0;) {
 522             int x0 = (int) (Math.sqrt(R * R - (Y - R) * (Y - R)) + 0.5);
 523             int p = Y * (R * 2) + R - x0;
 524             for (int X = -x0; X < x0; X++) {
 525                 int x = X + hx;
 526                 int y = Y - R + hy;
 527                 int r = (int) (Math.sqrt(x * x + y * y) + 0.5);
 528                 if (r > mr) {
 529                     mr = r;
 530                 }
 531                 data[p++] = r <= 0 ? 1 : (byte) r;