The Higher Genus Toroidal Solids are a collection of toroidal solids. A toroidal solid is an orientable polyhedron without self-intersections that has genus greater than zero, meaning that it contains one or more holes. An orientable polyhedron's genus (G) is related to the number of vertices (V), faces (F), and edges (E) as:
float C0 = length * 0.0f; float C1 = length * 1.0f; float C2 = length * 2.0f; float C3 = length * 3.0f; float C4 = length * 6.0f; float C5 = length * 8.0f; float C6 = length * 9.0f; float C7 = length * 10.0f; float C8 = length * 12.0f; float C9 = length * 13.0f; float C10 = length * 14.0f; float C11 = length * 20.0f; float C12 = length * 23.0f; // 建立TriangleMesh TriangleMesh trianglemesh = new TriangleMesh(); // 設定頂點座標 trianglemesh.getPoints().addAll( -C12, -C11, C0, C12, -C11, C0, C12, C11, C0, -C12, C11, C0, -C9, C0, C11, C9, C0, -C11, C9, C0, C11, -C9, C0, -C11, -C3, -C7, C7, C3, -C7, -C7, C3, C7, C7, -C3, C7, -C7, C3, -C2, -C2, -C3, -C2, C2, C3, C2, C2, -C3, C2, -C2, C9, C5, -C8, -C9, C5, C8, C9, -C5, C8, -C9, -C5, -C8, -C1, -C2, C4, C1, -C2, -C4, C1, C2, C4, -C1, C2, -C4, -C6, C4, C10, C6, C4, -C10, C6, -C4, C10, -C6, -C4, -C10 ); // 設定貼圖座標 trianglemesh.getTexCoords().addAll( 0.0f, 0.0f, // 0 0.5f, 0.0f, // 1 1.0f, 0.0f, // 2 0.0f, 0.5f, // 3 0.5f, 0.5f, // 4 1.0f, 0.5f, // 5 0.0f, 1.0f, // 6 0.5f, 1.0f, // 7 1.0f, 1.0f // 8 ); // 設定各三角形的面 trianglemesh.getFaces().addAll( 8, 0, 0, 3, 1, 1, // Red 8, 0, 1, 3, 26, 1, // Red 8, 0, 26, 3, 4, 1, // Red 4, 0, 26, 3, 6, 1, // Red 6, 0, 26, 3, 18, 1, // Red 4, 3, 21, 6, 8, 7, // Green 4, 3, 13, 6, 21, 7, // Green 4, 3, 17, 6, 13, 7, // Green 13, 3, 23, 6, 21, 7, // Green 13, 3, 15, 6, 23, 7, // Green 8, 1, 27, 5, 0, 2, // Yellow 8, 1, 21, 5, 27, 2, // Yellow 21, 1, 25, 5, 27, 2, // Yellow 21, 1, 16, 5, 25, 2, // Yellow 21, 1, 12, 5, 16, 2, // Yellow 9, 0, 1, 3, 0, 1, // Red 9, 0, 0, 3, 27, 1, // Red 9, 0, 27, 3, 5, 1, // Red 5, 0, 27, 3, 7, 1, // Red 7, 0, 27, 3, 19, 1, // Red 5, 3, 20, 6, 9, 7, // Green 5, 3, 12, 6, 20, 7, // Green 5, 3, 16, 6, 12, 7, // Green 12, 3, 22, 6, 20, 7, // Green 12, 3, 14, 6, 22, 7, // Green 9, 1, 26, 5, 1, 2, // Yellow 9, 1, 20, 5, 26, 2, // Yellow 20, 1, 24, 5, 26, 2, // Yellow 20, 1, 17, 5, 24, 2, // Yellow 20, 1, 13, 5, 17, 2, // Yellow 10, 0, 2, 3, 3, 1, // Red 10, 0, 3, 3, 24, 1, // Red 10, 0, 24, 3, 6, 1, // Red 6, 0, 24, 3, 4, 1, // Red 4, 0, 24, 3, 17, 1, // Red 6, 3, 23, 6, 10, 7, // Green 6, 3, 14, 6, 23, 7, // Green 6, 3, 18, 6, 14, 7, // Green 14, 3, 21, 6, 23, 7, // Green 14, 3, 12, 6, 21, 7, // Green 10, 1, 25, 5, 2, 2, // Yellow 10, 1, 23, 5, 25, 2, // Yellow 23, 1, 27, 5, 25, 2, // Yellow 23, 1, 19, 5, 27, 2, // Yellow 23, 1, 15, 5, 19, 2, // Yellow 11, 0, 3, 3, 2, 1, // Red 11, 0, 2, 3, 25, 1, // Red 11, 0, 25, 3, 7, 1, // Red 7, 0, 25, 3, 5, 1, // Red 5, 0, 25, 3, 16, 1, // Red 7, 3, 22, 6, 11, 7, // Green 7, 3, 15, 6, 22, 7, // Green 7, 3, 19, 6, 15, 7, // Green 15, 3, 20, 6, 22, 7, // Green 15, 3, 13, 6, 20, 7, // Green 11, 1, 24, 5, 3, 2, // Yellow 11, 1, 22, 5, 24, 2, // Yellow 22, 1, 26, 5, 24, 2, // Yellow 22, 1, 18, 5, 26, 2, // Yellow 22, 1, 14, 5, 18, 2 // Yellow ); // 設定各面的平滑參數 trianglemesh.getFaceSmoothingGroups().addAll( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); // 建立MeshView MeshView meshview; meshview = new MeshView(createMesh(6)); ...【參考資料】
[1] Java Official Web Site:http://www.oracle.com/technetwork/java/index.html
[2] JavaFX:http://www.oracle.com/technetwork/java/javafx
[3] JavaFX 8.0 API Specification.
[4] Java Platform, Standard Edition 8 API Specification.
[5] JDK 8 Certified System Configurations.
[6] H. M. Cundy, A. P. Rollett, Mathematical Models, Tarquin Publications, 1981.
[7] G. Sellers, R. S. Wright, N. Haemel, OpenGL SuperBible: Comprehensive Tutorial and Reference (6th Edition), Addison-Wesley Professional, 2013.
[8] 黃嘉輝, JavaFX 8技術手冊, ISBN: 9789863474050, 碁峰資訊, 2014.
© Chia-Hui Huang