// plot44.java development test for perspective Utah graphics .dat // rotations about dimensions X>, Y>, Z>, W> // color surfaces sorted X+, Y+, Z+, W+ // needs datread44.java Matrix.java // // perspective Viewing, Resize Choices and Transformation Matrices. // makes a 2D screen look like a 4D sceen. // In the simplest case, computing the i,j screen position of // a vertex at world coordinates x,y,z,w is accomplished by // multiplying a 5 by 5 perspective matrix by a 5 by 5 model matrix // times the x,y,z,w,p vertex vector, then placing the i,j in // the viewport. // // Name the vertices on the diagram as: // On the 'near' rectangle, the lower left is xmin,ymin,zmin,qmin // the upper left is 'xmin' 'ymax' // the lower right is 'xmax' 'ymin' // the upper right is 'xmax' 'ymax' // The distance from the eye to near is 'near' a positive number // The distance from the eye to far is 'far' a positive number // // The 5 by 5 perspective matrix is // 4D, four dimensional rendering, uses 5 by 5 matrices: // Note that there are now eight (8) degrees of freedom: // Move in X, Y, Z, W, P and rotations about each axis (split into 6 matrices) // Notation: x is left and right. // y is up and down // z is forward and back // w is in and out (a fourth spacial dimension) // p = 1.0 point or vertex // The 5 by 5 perspective matrix PM is // // |2*near 0.0 0.0 xmax+xmin 0.0 | // |--------- --------- | // |xmax-xmin xmax-xmin | // | | // | 0.0 2*near 0.0 ymax+ymin 0.0 | // | -------- --------- | // | ymax-ymin ymax-ymin | // | | // | 0.0 0.0 2*near zmax+zmin 0.0 | // | ------- ----------- | // | zmax-zmin zmax-zmin | // | | // | 0.0 0.0 0.0 -(far+near) -2*far*near | // | ----------- ----------- | // | far-near far-near | // | | // | 0.0 0.0 0.0 -1.0 0.0 | // // PM = makePM(xmin, xmax, ymin, ymax, zmin, zmax, near, far) // // The model view matrix is the product of the needed matrices below. // // The translation matrix TM, to translate 0,0,0,0 to x,y,z,w is // | 1.0 0.0 0.0 0.0 fx | // | 0.0 1.0 0.0 0.0 fy | unused translations are 0.0 // | 0.0 0.0 1.0 0.0 fz | // | 0.0 0.0 0.0 1.0 fw | // | 0.0 0.0 0.0 0.0 1.0 | // // TM = makeTM(fx,fy,fz,fw) // new (x, y, z, w, p) = TM * (x, y, z, w, p) // // // The scaling matrix SM, to scale x by sx, y by sy, z by sz, w by sw is // | sx 0.0 0.0 0.0 0.0 | // | 0.0 sy 0.0 0.0 0.0 | unused scales are 1.0 // | 0.0 0.0 sz 0.0 0.0 | // | 0.0 0.0 0.0 sw 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // SM = make_SM(sx, sy, sz, sw) // new (x, y, z, w, p) = SM * (x, y, z, w, p) // // // The rotation matrix by angle a about the X,Y axis is // | 1.0 0.0 0.0 0.0 0.0 | // | 0.0 1.0 0.0 0.0 0.0 | // | 0.0 0.0 cos a -sin a 0.0 | // | 0.0 0.0 sin a cos a 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // XY = makeXY(a) // new (x, y, z, w, p) = XY * (x, y, z, w, p) // // // The rotation matrix by angle a about the X,Z axis is // | 1.0 0.0 0.0 0.0 0.0 | // | 0.0 cos a 0.0 -sin a 0.0 | // | 0.0 0.0 1.0 0.0 0.0 | // | 0.0 sin a 0.0 cos a 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // XZ = makeXZ(a) // new (x, y, z, w, p) = XZ * (x, y, z, w, p) // // // The rotation matrix by angle a about the X,W axis is // | 1.0 0.0 0.0 0.0 0.0 | // | 0.0 cos a -sin a 0.0 0.0 | // | 0.0 sin a cos a 0.0 0.0 | // | 0.0 0.0 0.0 1.0 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // XW = makeXW(a) // new (x, y, z, w, p) = XW * (x, y, z, w, p) // // // The rotation matrix by angle a about the Y,Z axis is // | cos a 0.0 0.0 -sin a 0.0 | // | 0.0 1.0 0.0 0.0 0.0 | // | 0.0 0.0 1.0 0.0 0.0 | // | sin a 0.0 0.0 cos a 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // YZ = makeYZ(a) // new (x, y, z, w, p) = YZ * (x, y, z, w, p) // // // The rotation matrix by angle a about the Y,W axis is // | cos a 0.0 -sin a 0.0 0.0 | // | 0.0 1.0 0.0 0.0 0.0 | // | sin a 0.0 cos a 0.0 0.0 | // | 0.0 0.0 0.0 1.0 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // YW = makeYW(a) // new (x, y, z, w, p) = YW * (x, y, z, w, p) // // // The rotation matrix by angle a about the Z,W axis is // | cos a -sin a 0.0 0.0 0.0 | // | sin a cos a 0.0 0.0 0.0 | // | 0.0 0.0 1.0 0.0 0.0 | // | 0.0 0.0 0.0 1.0 0.0 | // | 0.0 0.0 0.0 0.0 1.0 | // // ZW = makeZW(a) // new (x, y, z, w, p) = ZW * (x, y, z, w, p) // // // To get a rotation about only the X axis by ax, // use the matrix product of X,Y X,Z X,W = XR // new (x, y, z, w, p) = XY(ax) * XZ(ax) * XW(ax) * (x, y, z, w, p) // // To get a rotation about only the Y axis by ay, // use the matrix product of X,Y Y,Z Y,W = YR // new (x, y, z, w, p) = XY(ay) * YZ(ay) * YW(ay) * (x, y, z, w, p) // // To get a rotation about only the Z axis by az, // use the matrix product of X,Z Y,Z Z,W = ZR // new (x, y, z, w, p) = XZ(az) * YZ(az) * ZW(az) * (x, y, z, w, p) // // To get a rotation about only the W axis, // use the matrix product of X,W Y,W Z,W =WR // new (x, y, z, w, p) = XW(aw) * YW(aw) * ZW(aw) * (x, y, z, w, p) // // // A user world coordinate vertex p = x, y, z, w, p (p=1.0) // is transformed into pp by // // perspective matrix times selection of model view matrix times p is pp // // To get screen coordinates, given the screen width w, and // screen height h, // // screen x = w * ((pp.x/pp.w)-xmin)/(xmax-xmin) ? // screen y = h * ((pp.y/pp.w)-ymin)/(ymax-ymin) ? import java.io.*; import java.awt.*; import java.awt.event.*; import java.text.*; public class plot44 extends Frame { double PM[][] = new double[5][5]; // perspective matrix double TM[][] = new double[5][5]; // translation matrix double SM[][] = new double[5][5]; // scale matrix double XY[][] = new double[5][5]; // XY rotate matrix double XZ[][] = new double[5][5]; // XZ rotate matrix double XW[][] = new double[5][5]; // XW rotate matrix double YZ[][] = new double[5][5]; // YZ rotate matrix double YW[][] = new double[5][5]; // YW rotate matrix double ZW[][] = new double[5][5]; // ZW rotate matrix double XR[][] = new double[5][5]; // X rotate matrix ax, -ax double XRT[][] = new double[5][5]; // X rotate matrix transpose double XRI[][] = new double[5][5]; // X rotate matrix inverse double YR[][] = new double[5][5]; // Y rotate matrix ay, -ay double ZR[][] = new double[5][5]; // Z rotate matrix az, -az double WR[][] = new double[5][5]; // W rotate matrix aw, -aw double XYZWR[][] = new double[5][5]; // 4 angle rotate matrix double fx = 1.0; // offset for test, reset after test double fy = 2.0; double fz = 3.0; double fw = 4.0; double off = 0.0; double offx = 0.0; double offy = 0.0; double offz = 0.0; double offw = 0.0; double sx = 1.25; // scale for test, reset after test double sy = 1.33; double sz = 1.5; double sw = 1.7; double sca = 1.0; double scax = 1.0; double scay = 1.0; double scaz = 1.0; double scaw = 1.0; double Pi = Math.PI; double ax = (15.0/180.0)*Pi; // angle for testing, reset after test double ay = (30.0/180.0)*Pi; double az = (45.0/180.0)*Pi; double aw = (60.0/180.0)*Pi; double ang = 0.0; double angx = 0.0; // for XYZWR double angy = 0.0; double angz = 0.0; double angw = 0.0; double p1234[] = {1.0, 2.0, 3.0, 4.0, 1.0}; // for testing double p1111[] = {1.0, 1.0, 1.0, 1.0, 1.0}; // for testing double p0000[] = {0.0, 0.0, 0.0, 0.0, 1.0}; // for testing double pxi[] = {1.0, 0.0, 0.0, 0.0, 1.0}; double pyi[] = {0.0, 1.0, 0.0, 0.0, 1.0}; double pzi[] = {0.0, 0.0, 1.0, 0.0, 1.0}; double pwi[] = {0.0, 0.0, 0.0, 1.0, 1.0}; double pnxi[] = {-1.0, 0.0, 0.0, 0.0, 1.0}; double pnyi[] = {0.0, -1.0, 0.0, 0.0, 1.0}; double pnzi[] = {0.0, 0.0, -1.0, 0.0, 1.0}; double pnwi[] = {0.0, 0.0, 0.0, -1.0, 1.0}; double p[] = new double[5]; // temp for testing double p1[] = new double[5]; double p2[] = new double[5]; double p3[] = new double[5]; double pr[] = new double[5]; double M[][] = new double[5][5]; // temp double M1[][] = new double[5][5]; double xmin, xmax, ymin, ymax, zmin, zmax, wmin, wmax; double near, far; double a, b, c, d; // for testing // mouse and display variables boolean debug = false; boolean debug1 = true; // set true to check matrix operations boolean debug2 = false; // set true to check matrix operations int xm, ym, bm; // mouse position int height = 700; int width = 700; // must be same as height for ortho int xp, yp; // ortho returns int pts, pt, k; datread44 DR; // = new datread44(filename); // defines data structures String filein; int grid = 1; // box off/on int colora = 1; // black, X, Y, blue Z, red xW int points = 1; // lines, points only, both boolean fillc = false; double ss, za, ws, wf; // used in ortho String lcol[] = {" ", "x", "y", "z", "w"}; double xyzw[][] = new double[2000][5]; // DR.data_points for rotation int num_points = 0; // DR.num_points for rotation int num_polys = 0; // DR.num_polys for rotation DecimalFormat f1 = new DecimalFormat("0.00000"); double nx, ny, nz, nw; // global for normal4 float red, grn, blu; int pripoly[] = new int[2000]; // for sort int priindex[] = new int[2000]; int kpoly; double prix[] = new double[2000]; // used for sort double priy[] = new double[2000]; double priz[] = new double[2000]; double priw[] = new double[2000]; double avgx, avgy, avgz, avgw; boolean xplus = false; boolean yplus = false; boolean zplus = false; boolean wplus = false; boolean xsort = false; boolean ysort = false; boolean zsort = false; boolean wsort = false; public plot44(String filename) { System.out.println("plot44.java running"); setTitle("plot44"); setSize(width,height); setBackground(Color.white); setForeground(Color.black); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.out.println("plot44.java window closed."); System.exit(0); } }); setVisible(true); this.addMouseListener (new mousePressHandler()); System.out.println("plot44.java rotate test running"); System.out.println("test matrix functions"); // test_matrix(); ax = (15.0/180.0)*Pi; ay = (15.0/180.0)*Pi; az = (15.0/180.0)*Pi; aw = (15.0/180.0)*Pi; angx = 0.0; angy = 0.0; angz = 0.0; angw = 0.0; scax = 1.1; scay = 1.1; scaz = 1.1; scaw = 1.1; offx = 0.1; offy = 0.1; offz = 0.1; offw = 0.1; // System.out.println("datread44.java reading "+filename); filein = filename; DR = new datread44(filename); // defines data structures num_points = DR.num_points; num_polys = DR.num_polys; System.out.println("num_points="+num_points+ ", num_polys="+num_polys); System.out.println("print vertices"); xmin = DR.data_points[0].x; xmax = DR.data_points[0].x; ymin = DR.data_points[0].y; ymax = DR.data_points[0].y; zmin = DR.data_points[0].z; zmax = DR.data_points[0].z; wmin = DR.data_points[0].w; wmax = DR.data_points[0].w; for(int i=0; i else if(in_rect(width-170, height-60, 30, 15)) // < { System.out.println(" { if(debug) System.out.println("X>"); angx += ax; makeXR(angx,XR); for(int i=0; i"); angy += ay; makeYR(angy,YR); for(int i=0; i"); angz += az; makeZR(angz,ZR); for(int i=0; i"); angw += aw; makeWR(angw,WR); for(int i=0; i"); angx += ax; angy += ay; angz += az; angw += aw; makeXYZWR(angx, angy, angz, angw, XYZWR); for(int i=0; i { if(debug) System.out.println("X+"); xsort = true; ysort = false; zsort = false; wsort = false; } else if(in_rect(width-135, height-120, 30, 15)) { if(debug) System.out.println("Y+"); ysort = true; xsort = false; zsort = false; wsort = false; } else if(in_rect(width-100, height-120, 30, 15)) { if(debug) System.out.println("Z+"); zsort = true; xsort = false; ysort = false; wsort = false; } else if(in_rect(width-65, height-120, 30, 15)) { if(debug) System.out.println("W+"); wsort = true; xsort = false; ysort = false; zsort = false; } else if(in_rect(width-170, height-100, 30, 15)) // > { if(debug) System.out.println("X+"); xplus = true; } else if(in_rect(width-135, height-100, 30, 15)) { if(debug) System.out.println("Y+"); yplus = true; } else if(in_rect(width-100, height-100, 30, 15)) { if(debug) System.out.println("Z+"); zplus = true; } else if(in_rect(width-65, height-100, 30, 15)) { if(debug) System.out.println("W+"); wplus = true; } else { // do nothing return; } xm = -1; // prevent reclick ym = -1; requestFocus(); repaint(); } // end mousePressed } // end mousePressHandler boolean in_rect(int x, int y, int w, int h) { return xm>x && xmy && ym", width-167, height-67); g.setColor(Color.red); g.fillRect(width-170,height-60,30,15); g.setColor(Color.black); g.drawString("", width-132, height-67); g.setColor(Color.red); g.fillRect(width-135,height-60,30,15); g.setColor(Color.black); g.drawString("", width-97, height-67); g.setColor(Color.red); g.fillRect(width-100,height-60,30,15); g.setColor(Color.black); g.drawString("", width-63, height-67); g.setColor(Color.red); g.fillRect(width-65,height-60,30,15); g.setColor(Color.black); g.drawString("", width-27, height-67); g.setColor(Color.red); g.fillRect(width-30,height-60,30,15); g.setColor(Color.black); g.drawString("", width-63, height-107); g.setColor(Color.red); g.fillRect(width-65,height-100,30,15); g.setColor(Color.black); g.drawString(" W-", width-63, height-87); g.setColor(Color.green); g.fillRect(width-30,height-120,30,15); g.setColor(Color.black); g.drawString("COL", width-27, height-107); g.setColor(Color.red); g.fillRect(width-30,height-100,30,15); g.setColor(Color.black); g.drawString("COL", width-27, height-87); // color scale for(int i=1; i<=ncol; i++) { set_color(i, g); g.fillRect(20,60+20*i,50,15); fstring = Integer.toString(i); g.setColor(Color.black); g.drawString(lcol[i], 80, 60+12+20*i); } // end i // min and max g.setColor(Color.black); g.drawString("reading file "+filein, 20, 60); g.drawString("npts=", 95, 75); fstring = Integer.toString(DR.num_points); g.drawString(fstring, 145, 75); g.drawString("npoly=", 95, 90); fstring = Integer.toString(DR.num_polys); g.drawString(fstring, 145, 90); g.drawString("x min=", 190, 60); // fstring = Double.toString(ez(xmin)); fstring = f1.format(xmin); g.drawString(fstring, 240, 60); g.drawString("x max=", 400, 60); //fstring = Double.toString(ez(xmax)); fstring = f1.format(xmax); g.drawString(fstring, 450, 60); g.drawString("angx=", 600, 60); // angx // fstring = Integer.toString((int)((angx/Pi)*180.0+0.5)); fstring = intang(angx); g.drawString(fstring, 650, 60); g.drawString("y min=", 190, 75); // fstring = Double.toString(ez(ymin)); fstring = f1.format(ymin); g.drawString(fstring, 240, 75); g.drawString("y max=", 400, 75); // fstring = Double.toString(ez(ymax)); fstring = f1.format(ymax); g.drawString(fstring, 450, 75); g.drawString("angy=", 600, 75); // angy // fstring = Integer.toString((int)((angy/Pi)*180.0+0.5)); fstring = intang(angy); g.drawString(fstring, 650, 75); g.drawString("z min=", 190, 90); //fstring = Double.toString(ez(zmin)); fstring = f1.format(zmin); g.drawString(fstring, 240, 90); g.drawString("z max=", 400, 90); // fstring = Double.toString(ez(zmax)); fstring = f1.format(zmax); g.drawString(fstring, 450, 90); g.drawString("angz=", 600, 90); // angz // fstring = Integer.toString((int)((angz/Pi)*180.0+0.5)); fstring = intang(angz); g.drawString(fstring, 650, 90); g.drawString("w min=", 190, 105); // fstring = Double.toString(ez(wmin)); fstring = f1.format(wmin); g.drawString(fstring, 240, 105); g.drawString("w max=", 400,105); // fstring = Double.toString(ez(wmax)); fstring = f1.format(wmax); g.drawString(fstring, 450, 105); g.drawString("angw=", 600, 105); // angw // fstring = Integer.toString((int)((angw/Pi)*180.0+0.5)); fstring = intang(angw); g.drawString(fstring, 650, 105); ortho(xmin, ymin, zmin, wmin); // just setup if(grid>0) { // axis labels x1, x2, x3, x5 g.drawString("x min", 25, height-10); g.drawString("x max", (int)(ss*width-65), height-10); g.drawString("y min", (int)(ss*width), (int)(height-25)); g.drawString("y max", (int)(width-100), (int)(550)); g.drawString("z min", (int)(width-90), (int)(535)); g.drawString("z max", (int)(width-90), (int)(120)); g.drawString("w min", (int)(190), (int)(485)); g.drawString("w max", (int)(220), (int)(450)); // draw box x and y and z and w side number ortho(xmin, ymin, zmin, wmin); xp1=xp; yp1=yp; // 1 ortho(xmin, ymax, zmin, wmin); xp2=xp; yp2=yp; g.setColor(Color.black); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); ortho(xmin, ymin, zmin, wmin); xp1=xp; yp1=yp; // 2 ortho(xmax, ymin, zmin, wmin); xp2=xp; yp2=yp; g.setColor(Color.black); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymin, zmin, wmin); xp1=xp; yp1=yp; // 3 ortho(xmax, ymax, zmin, wmin); xp2=xp; yp2=yp; g.setColor(Color.black); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); ortho(xmin, ymax, zmin, wmin); xp1=xp; yp1=yp; // 4 ortho(xmax, ymax, zmin, wmin); xp2=xp; yp2=yp; g.setColor(Color.black); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymax, zmin, wmin); xp1=xp; yp1=yp; // 5 ortho(xmin, ymax, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymax, zmax, wmin); xp1=xp; yp1=yp; // 6 ortho(xmax, ymax, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymax, zmin, wmin); xp1=xp; yp1=yp; // 7 ortho(xmax, ymax, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymin, zmin, wmin); xp1=xp; yp1=yp; // 8 ortho(xmax, ymin, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); ortho(xmax, ymin, zmax, wmin); xp1=xp; yp1=yp; // 9 ortho(xmax, ymax, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); ortho(xmin, ymin, zmin, wmin); xp1=xp; yp1=yp; // 10 ortho(xmin, ymin, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymin, zmax, wmin); xp1=xp; yp1=yp; // 11 ortho(xmin, ymax, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); ortho(xmin, ymin, zmax, wmin); xp1=xp; yp1=yp; // 12 ortho(xmax, ymin, zmax, wmin); xp2=xp; yp2=yp; g.setColor(Color.blue); g.drawLine(xp1, yp1, xp2, yp2); // } // if(grid>0 && (Math.abs(wmax-wmin)>0.01) || wmax>0.01) // option // { // w box // draw box x4 side number g.setColor(Color.red); ortho(xmin, ymin, zmin, wmax); xp1=xp; yp1=yp; // 13 ortho(xmin, ymax, zmin, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymin, zmin, wmax); xp1=xp; yp1=yp; // 14 ortho(xmax, ymin, zmin, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymin, zmin, wmax); xp1=xp; yp1=yp; // 15 ortho(xmax, ymax, zmin, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymax, zmin, wmax); xp1=xp; yp1=yp; // 16 ortho(xmax, ymax, zmin, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymax, zmin, wmax); xp1=xp; yp1=yp; // 17 ortho(xmin, ymax, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymax, zmax, wmax); xp1=xp; yp1=yp; // 18 ortho(xmax, ymax, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymax, zmin, wmax); xp1=xp; yp1=yp; // 19 ortho(xmax, ymax, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymin, zmin, wmax); xp1=xp; yp1=yp; // 20 ortho(xmax, ymin, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmax, ymin, zmax, wmax); xp1=xp; yp1=yp; // 21 ortho(xmax, ymax, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymin, zmin, wmax); xp1=xp; yp1=yp; // 22 ortho(xmin, ymin, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymin, zmax, wmax); xp1=xp; yp1=yp; // 23 ortho(xmin, ymax, zmax, wmax); xp2=xp; yp2=yp; g.fillOval(xp2-4, yp2-4, 8, 8); g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); ortho(xmin, ymin, zmax, wmax); xp1=xp; yp1=yp; // 24 ortho(xmax, ymin, zmax, wmax); xp2=xp; yp2=yp; g.drawLine(xp1, yp1, xp2, yp2); g.fillOval(xp1-4, yp1-4, 8, 8); g.fillOval(xp2-4, yp2-4, 8, 8); } // plot function or data with optional colors, points k = 0; // polygons auto incr avgx = 0.0; // for sort avgy = 0.0; avgz = 0.0; avgw = 0.0; for(int i=0; i0.0) deg = deg + 0.5; // round if(deg<0.0) deg = deg - 0.5; return Integer.toString((int)deg); } // end intang void maxmin(double M[][]) { xmin = M[0][0]; xmax = M[0][0]; ymin = M[0][1]; ymax = M[0][1]; zmin = M[0][2]; zmax = M[0][2]; wmin = M[0][3]; wmax = M[0][3]; for(int i=1; i