// cyl1_base.java compile javac -cp . cyl1_base.java // execute java -cp . cyl1_base // writes cyl1_base.dat // execute dat_to_stl cyl1_base.dat cyl1_base.stl // // ******** cylinder covered by triangles // **** **** // *** **** *** point numbers // ** *** *** ** // * * inside * * outside top pt1+1 .. pt1+16 // |** |*** ***| **| // | *** | **** | *** | inside top pt3+1 .. pt3+16 // | **** **** | // | | ******** | | // | | | | // | | | | // | | ******** | | // | **** **** | // | *** | **** | *** | inside bottom pt2+1 .. pt2+16 // |** |*** ***| **| // * * inside * * outside bottom pt0+1 .. pt0+16 // ** *** *** ** // *** **** *** // **** **** // ******** public class cyl1_base // make cyl1_base.dat then .stl for 3D printer { public cyl1_base() { int num_points = 0; double data_points[][] = new double[5000][3]; int num_polys = 0; int k = 0; // k index+1/4 = num_polys int data_polys[] = new int[5000]; // 3 pt1 pt2 pt3 +1 index double pi = 3.14159265358979323846; double theta, x, y, z; double r = 10.0; int pts = 16; double dfct = (double)pts/2.0; // 0.0 to 2 pi double dtheta = pi/dfct; int pt0=0; // outside bottom int pt1=pts; // outside top int pt2=2*pts; // inside botton int pt3=3*pts; // inside top int pt4=4*pts; // end System.out.println("cyl1_base.java writing cyl1_base.stl"); System.out.println("r="+r+", pts="+pts+", dtheta="+dtheta); System.out.println("outside bottom points "+(pt0+1)+" to "+(pt1)); System.out.println("outside top points "+(pt1+1)+" to "+(pt2)); for(int i=0; i * -> * 16 33 1 // 48 33 34 System.out.println(" "); System.out.println("generate triangles bottom"); for(int i=0; i * -> * 17 50 49 first // \ ^ | ^ | 17 18 50 // ^ \ \ v ^ \ v // | v \ | \ 32 49 64 last // * <- * <- * 32 17 49 // 64 49 50 System.out.println(" "); System.out.println("generate triangles top"); for(int i=0; i