<- previous index next ->
There may be an application where a 3D object is needed as a group of smaller objects of the same shape, that together make the original object. One application is subdividing a 3D object into many small volumes for solving a partial differential equation by the finite volume method, FVM. Another application is subdividing the surface of a 3D object into smaller surface elements to get a smoother 3D printed object.tetra split example
The first example is tetra_split1. Given a .dat file with a single tetrahedron, generate another .dat file that has smaller tetrahedrons that when connected together make the original tetrahedron. A tetrahedron is a 4 sided 3D object. Each of the four sides is a triangle. The .dat file has 4 vertex of the tetrahedron and the four triangles using the vertex. ( from tetra2.dat 4 4 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.500000 0.866000 0.000000 0.500000 0.433000 0.866000 3 1 2 4 3 2 3 4 3 3 1 4 3 1 2 3 ) The splitting program tetra_split1.java has a crude diagram of the added vertex to make the smaller tetrahedron: 4 input: 4 triangles /\ 1 2 4 / |\ * 11 center 1 2 4 / | \ 2 3 4 7 * | * 10 midpoint 3 1 4 / 6 | \ /__*__|__ _\ output 12 tetrahedrons 1 \ | / 3 1 5 6 7 not drawn. \ *9 / 2 8 9 5 Each written \ | / 3 10 6 8 as 4 triangles 5 * | * 8 4 7 9 10 in .dat file. \ |/ 5 6 7 11 \/ 8 9 5 11 2 10 6 8 11 7 9 10 11 5 7 9 11 8 9 10 11 6 7 10 11 5 6 8 11 See tetra2sp.dat tetra_split1.java program tetra_split1_java.out output tetra2.dat input file tetra2sp.dat output file Resulting tetrahedrons, 4 triangles each, that fill the original tetrahedron. Measurement of regular tetrahedron area and volume are shown in tetra_split.java source code tetra_split_java.out outputtri_split example
This example splits each 2D triangle into 4 triangles. tri_split.java plot 3d data Utah graphics .dat split every triangle into 4 triangle ip1 np1 ip2 *---+---* \1/4\2/ * initial points np3 +---+ np2 + new points at edge center of initial triangle \3/ four triangles replace initial triangle * remember, in utah .dat ip and np are +1 of subscript ip3 tri_split1.java program datread.java used datwrite.java used tri_split.dat input data tri_split2.dat output data star4_tri.dat output datasphere_div example
This example splits the triangles that cover the surface of a sphere. Applications include getting better graphics of a sphere and 3D printer .stl files that produce smoother surface spheres. sphere_div.java program datread.java used datwrite.java used sphere_div2.dat result sphere_div3.dat result sphere_div4.dat result
<- previous index next ->
Many web sites on Java GUI, AWT, Swing, etc. Many web sites on Python wx, tk, qt, etc.