// toro_area.java solution to PDE import java.awt.*; import java.awt.event.*; public class toro_area extends Frame { int height = 600; int width = 600; // specific plot boundaries double x, y, z, t; // orthographic z up, x across, y back double xang = Math.PI/4.0; // 45 degrees double yang = Math.PI/6.0; // 30 degrees double r1 = 2.0; double r2 = 0.5; double xmin = -(r1+r2); double xmax = r1+r2; double ymin = -(r1+r2); double ymax = r1+r2; double zmin = -(r1+r2); // actually -r2, keep equal scaling in plot double zmax = (r1+r2); // actually r2 // surface generation int nth = 96; int nph = 24; int n = nth*nph; // total points double far[] = new double[n]; double ftheta[] = new double[n]; double fphi[] = new double[n]; int ixk[] = new int[n]; double dtheta = 2.0*Math.PI/(double) nth; double dphi = 2.0*Math.PI/(double)nph; double theta_max = 2.0*Math.PI; double phi_max = 2.0*Math.PI; double area, tarea, rerr; double volume, tvolume, verr; toro_area() { double x1, x2, x3, x4; double y1, y2, y3, y4; double z1, z2, z3, z4; double theta, phi; int k; heapsort H = new heapsort(); setTitle("toro_area"); setSize(width,height); setBackground(Color.white); setForeground(Color.black); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); setVisible(true); // build points, sort for display for(int i=0; i