You can write a loader for your file format, or if you don't want to bother with it, the simplest thing to do is to transform your file into a .obj file, which should be straight forward:
To define a vertex you use: v x y z To define a face f v1 v2 v3 ... The vertex number in face definition is the vertex index in the vertex list, so you should start with vertex 0, 1 then 2, 3, ... Also, be aware that vertex index starts with 1, not 0, so you should add 1 to the elements in the face definition. The rest of the information in your file is irrelevant. You can even write a small program to automaticaly generate .obj files from your file format. Sample file: # comment here # group name g polyhedron # vertex list v 0 0 1.1547 v 1. 0 0.57735 v 0.333333 0.942809 0.57735 v -1. 0 0.57735 v -0.333333 -0.942809 0.57735 v 1. 0 -0.57735 v 0.666667 -0.942809 0 v -0.666667 0.942809 0 v 0.333333 0.942809 -0.57735 v -1. 0 -0.57735 v -0.333333 -0.942809 -0.57735 v 0 0 -1.1547 # face list f 3 2 1 f 1 4 5 f 2 7 6 f 3 9 8 f 4 8 10 f 5 11 7 f 6 12 9 f 10 12 11 f 1 3 8 4 f 1 5 7 2 f 2 6 9 3 f 4 10 11 5 f 6 7 11 12 f 8 9 12 10 # end of file Now you just cut the file from above and save it in something that ends with .obj and then you can use any of the objload demos provided with the java3d distribution to load the file. Those demos will even automaticaly generate the facet normals for you ! Cheers, Florin P.S. Attached is your polyhedron as loaded from the above .obj file -----Urspr�ngliche Nachricht----- Von: ������� [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 6. Juni 2003 08:39 An: [EMAIL PROTECTED] Betreff: Re: [JAVA3D] niewbie in Java3d, HELP In my case i have to load a file that consists of the coordinates, Vertices and Facets of a polyhedron. I have managed to isolate the useful information from the text file, and now all i need is to supply these info in a program that generate shape! Here is my text file ---------------- SIZE: 500x500 BEGIN OBJECT POLYHEDRON CORRECT ORIENTATION: A BEGIN VERTICES 2: 0.333333 0.942809 0.57735; 3: -1. 0 0.57735; 4: -0.333333 -0.942809 0.57735; 5: 1. 0 -0.57735; 6: 0.666667 -0.942809 0; 7: -0.666667 0.942809 0; 8: 0.333333 0.942809 -0.57735; 9: -1. 0 -0.57735; 10: -0.333333 -0.942809 -0.57735; 11: 0 0 -1.1547; 0: 0 0 1.1547; 1: 1. 0 0.57735; END VERTICES BEGIN FACETS A: 2 1 0; B: 0 3 4; C: 1 6 5; D: 2 8 7; E: 3 7 9; F: 4 10 6; G: 5 11 8; H: 9 11 10; I: 0 2 7 3; J: 0 4 6 1; K: 1 5 8 2; L: 3 9 10 4; M: 5 6 10 11; N: 7 8 11 9; END FACETS END OBJECT POLYHEDRON ------------------
poly.png
Description: Binary data
