array. This coordinate array should first define the
2,1,0, //9 //these are vertices for the hole 1,3,0, //10 2,3,0, //11 3,2,0, //12 3,1,0, //13 2,2,0};//14 //triangulate the polygon GeometryInfo gi = new GeometryInfo( GeometryInfo.POLYGON_ARRAY ); gi.setCoordinates( m_VertexArray ); //the first 10 points make up the outer edge of the polygon, //the next five make up the hole int[] stripCountArray = {10,5}; int[] countourCountArray = {stripCountArray.length}; gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator = new Triangulator(); triangulator.triangulate( gi ); //also generate normal vectors so that the surface can be light NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals( gi ); //create an appearance Appearance ap = new Appearance(); //render as a wireframe PolygonAttributes polyAttrbutes = new PolygonAttributes(); polyAttrbutes.setPolygonMode( PolygonAttributes.POLYGON_LINE ); polyAttrbutes.setCullFace( PolygonAttributes.CULL_NONE ) ; ap.setPolygonAttributes( polyAttrbutes ); //add both a wireframe and a solid version //of the triangulated surface Shape3D shape1 = new Shape3D( gi.getGeometryArray(), ap ); Shape3D shape2 = new Shape3D( gi.getGeometryArray() ); After the geometry has been triangulated and normal vectors have been calculated, the geometry can be very easily stripified: //invoke the Stripifier on the GeometryInfo Stripifier st = new Stripifier() st.stripify(gi); //extract the stripified GeometryArray Shape3D shape2 = new Shape3D( gi.getGeometryArray() ); 15.3 Object loaders Sun has defined the com.sun.j3d.loaders.Loaderinterface that provides a standard set of methods for accessing the information read in from a 3D data file format. Because there is such a wide variety of 3D data file formats available, the Loaderinterfac e is fairly high level and does not return graphical information directly but encapsulates it in an object implementing the Sceneinterface. 261
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services