Hi all,

I'm trying to access a Shape3D's vertex info from an
IndexedTriangleStripArray
(generated from a polygon array using GeometryInfo's triangulator
followed by the stripifier).  The
problem is I seem to be getting a number of degenerate triangles.  On
printing out the coordinate
index information I found that some of the triangles include the same
vertex twice.
The TriangleStripArray documentation states that
"For every strip in the set, each vertex, beginning with the third
vertex in the array, defines a triangle
to be drawn using the current vertex and the two previous vertices."
I'm trying to find out whether I'm misinterpreting the above and
accessing the vertex indices incorrectly
(please see code snippet below).  Thanks!


Omolola

 =============================================================

In the code snippet below, organ is a Shape3D

        IndexedTriangleStripArray organCoords =
           (IndexedTriangleStripArray)organ.getGeometry();
       int vertexCount = organCoords.getValidVertexCount();
       int indexCount = organCoords.getValidIndexCount();
       int stripCount = organCoords.getNumStrips();
       int[] stripIndexCount = new int[stripCount];
       int[] coordinateIndices = new int[indexCount];

        organCoords.getCoordinateIndices(0, coordinateIndices);

       int lastStripIndCount = 0;
       for (int i = 0; i < stripCount; i++) {
           System.out.println("Strip " + i + " index count is " +
                              stripIndexCount[i]);
           for (int j = lastStripIndCount+2;
                j < lastStripIndCount + stripIndexCount[i]; j++) {
                   System.out.println("Coordinate index " + (j) + ": " +
                                      + coordinateIndices[j] +
                                      " Coordinate index " + (j-1) + ": " +
                                      + coordinateIndices[j-1] +
                                      " Coordinate index " + (j-2) + ": " +
                                      + coordinateIndices[j-2]);

           }
           lastStripIndCount+= stripIndexCount[i];
       }

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to