// volume_dat2.java compute the volume of a single closed .dat graphics figure // compile with javac -cp . datread.java // compile with javac -cp . volume_dat2.java // run with java -cp . volume_dat bull.dat > volume_dat_bull.out // sailors algorithm - normal vector must be correct - best triangles public class volume_dat2 { boolean debug = false; volume_dat2(String filename) { datread DR; // = new datread(filename); // defines data structures int num_points = 0; // set from datread int num_polys = 0; // set from datread double xmin, xmax, ymin, ymax, zmin, zmax; double x1=0.0, x2=0.0, x3=0.0, y1=0.0, y2=0.0, y3=0.0, z1=0.0, z2=0.0, z3=0.0; double area=0.0, avgz, vol, dvol, minz, znorm, tarea; double earea, evol; double a, b, c; int i, j, k, npts, iv, pt, pts; double x[] = new double[32]; // max 32 points in polygon double y[] = new double[32]; double z[] = new double[32]; double ta[] = new double[1024]; System.out.println("volume_dat2.java reading "+filename); DR = new datread(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); xmin = DR.data_points[0].x; xmax = xmin; ymin = DR.data_points[0].y; ymax = ymin; zmin = DR.data_points[0].z; zmax = zmin; System.out.println("print vertices"); for(i=0; i