gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator
gi.setContourCounts( countourCountArray ); gi.setStripCounts( stripCountArray ); Triangulator triangulator = new Triangulator(); triangulator.triangulate( gi ); //Generate normal vectors for the triangles, not strictly necessary //as we are not lighting the scene, but generally useful. NormalGenerator normalGenerator = new NormalGenerator(); normalGenerator.generateNormals( gi ); //wrap the GeometryArray in a Shape3D and assign appearance return new Shape3D( gi.getGeometryArray(), app ); } /* * Handle the nitty-gritty details of loading the input file * and reading (in order): * - texture file image name * - size of the geometry in the X direction * - Y direction scale factor * - number of texture coordinates * - each texture coordinate (X Y) * This could all be easily accomplished using a scenegraph loader, * but this simple code is included for reference. */ protected TextureGeometryInfo createTextureCoordinates( String szFile ) { //create a simple wrapper class to package our return values TextureGeometryInfo texInfo = new TextureGeometryInfo(); //allocate a temporary buffer to store the input file StringBuffer szBufferData = new StringBuffer(); float sizeGeometryX = 0; float factorY = 1; int nNumPoints = 0; Point2f boundsPoint = new Point2f(); try { //attach a reader to the input file FileReader fileIn = new FileReader( szFile ); int nChar = 0; //read the entire file into the StringBuffer while( true ) { nChar = fileIn.read(); //if we have not hit the end of file //add the character to the StringBuffer if( nChar != -1 ) szBufferData.append( (char) nChar ); else //hit EOF break; } //create a tokenizer to tokenize the input file at whitespace 236
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services