// datread44.java read Utah Graphics .dat file 4D x y z w // x4 x3 x2 x1 lsb // all data available import java.io.*; import java.util.*; import java.text.*; public class datread44 { public class dpts { double x, y, z, w; dpts(double x, double y, double z, double w) { this.x = x; this.y = y; this.z = z; this.w = w; } } // end class dpts boolean debug = false; int num_points; int num_polys; dpts data_points[] = new dpts[5000]; int data_polys[] = new int[10000]; datread44(String filename) { double x, y, z, w; int k, vn, pts; StringTokenizer T; String token; System.out.println("datread44.java reading "+filename); try { FileReader fin = new FileReader(filename); BufferedReader in = new BufferedReader(fin); String input_line; String line; double amount; int len; int index; int last; input_line = in.readLine(); // npts npoly if(debug) System.out.println("input:"+input_line); len = input_line.length(); if(input_line.substring(0,1).equals(" ")) { input_line = input_line.substring(1,len); if(debug) System.out.println("short input:"+input_line); } len = input_line.length(); if(debug) System.out.println("length="+len); index = 0; // num_points if(debug) System.out.println("num_points index="+index); last = input_line.indexOf(' ',index); if(debug) System.out.println("num_index last="+last); if(debug) System.out.println(input_line.substring(index,last)+ "| len="+(input_line.substring(index,last).length())); num_points = Integer.parseInt(input_line.substring(index,last)); if(debug) System.out.println("num_points="+num_points); data_points = new dpts[num_points]; index = input_line.indexOf(' ',index); // num_polys if(debug) System.out.println("num_polys index="+index); last = input_line.indexOf(' ',index+1); if(last==-1) last = input_line.length(); if(debug) System.out.println("num_polys last="+last); if(debug) System.out.println(input_line.substring(index+1,last)); num_polys = Integer.parseInt(input_line.substring(index+1,last)); if(debug) System.out.println("num_polys="+num_polys); data_polys = new int[11*num_polys+100]; // read data points, x, y, z, w if(debug) System.out.println("reading x, y, z, w data points"); for(int n_input=0; n_input