Java Programing

February 4, 2007

array. This coordinate array should first define the

Filed under: Java 3D Programming — webmaster @ 11:29 pm

array. This coordinate array should first define the outer boundary of the polygon, using counterclockwi se winding. Then define any polygons that are to be excluded from the generated composite triangular surface. This simple example in figure 15.1 defines two contours: the outer polygon and one hole. The stripCountArrayis an array of integers that delineates one con tour from the next. In figure 15.1, the stripCountArraywould be int[] stripCountArray = {4,3}; Figure 15.1 Counterclockwise winding for defining a polygon and a hole for Triangulation Figure 15.2 Output from TriangulatorTest: The surface generated rendered both as a solid (left) and as a wireframe (right) The first contour (A,B,C,D) contains four vertices, and the hole (F,G,H) contains three vertices. The Triangulatorclass is not very well documented, so the following example should illustrate the concepts of polygon triangulation using the Triangulatorclass. In particular, the contourCountArrayelement is misleadingly documented and should be set t o the number of contours (1 + the number of holes). This is always the same as the length of the stripCountArray. Why the contourCountArrayis necessary is not clear. From TriangulatorTest.java //Generate a surface from 10 vertices and //create a hole in the surface by removing //a hole defined using 5 vertices. Note that the hole //must be entirely within the outer polygon. private double[] m_VertexArray = {1,1,0, //0 0,3,0, //1 1,5,0, //2 2,4,0, //3 4,5,0, //4 3,3,0, //5 4,2,0, //6 4,0,0, //7 3,0,0, //8 260

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Java Web Hosting