Hi,

Can anybody tell me, why the following two code fragments don�t have the
same effect. If I try it without Java3d (e.g. System.out.println("new
Point3d("+ ... ) ) I get the same result! I don�t understand what�s wrong
because the for-loop is  correct! Is this a J3D problem or what�s wrong?



/*===================================
 * 1st CODE FRAGMENT
 *==================================*/

double center_x = -0.9;


Point3d[] vertices = new Point3d[6];

    vertices[0] = new Point3d(center_x,0.9,0);
    vertices[1] = new Point3d(center_x,-0.4,-1);
    vertices[2] = new Point3d(0,0.0,0);
    vertices[3] = new Point3d(0,0.5,-1);
    vertices[4] = new Point3d(0.4,0.8,0);
    vertices[5] = new Point3d(0.8,-0.8,-1);

    int[] StripCount = {vertices.length};
                // TriangleStripArray
                TriangleStripArray tsa = new TriangleStripArray(vertices.length,

GeometryArray.COORDINATES,
                                                                StripCount);
                tsa.setCoordinates(0, vertices);
                // Shape3D with TriangleStripInformationen
                Shape3D t = new Shape3D();
                t.setAppearance(createTriangleAppearance());
                t.setGeometry(tsa);
                mouse.addChild(t);



/*===================================
 * 2nd CODE FRAGMENT
 *==================================*/
// The first code is the manual procedure for the following
// procedure which I want to compute for any kind of
// p x q-matrices! The first part was just a "control by hand"
// but I can�t do for any matrices!


int u = 0;
double center_x = -0.9;

double[][] matrix =
            {
                           {0.9, 0.0, 0.8},
                     {-0.4, 0.5,-0.8}
              };


for (int y=0; y < SIZE_Y-1; y++)
         {
                      System.out.println("begin(TRIANGLE_STRIP);");
          Point3d[] vertices = new Point3d[matrix[0].length*matrix.length];

         for (int x=0; x < SIZE_X; x++)
           {
                                        System.out.println("  Point3d(" + x + "," + 
matrix[y][x] + ", "
+ y +  ")");
                System.out.println("  Point3d(" + x + "," + matrix[y+1][x] +
", " + (y+1) +  ")");

                vertices[u] = new Point3d(center_x+x, matrix[y][x], -y);
                u++;
                vertices[u] = new Point3d(center_x+x, matrix[y][x], -(y+1));
                u++;
vertices[0] = new Point3d(center_x,0.9,0);
    vertices[1] = new Point3d(center_x,-0.4,-1);
    vertices[2] = new Point3d(0,0.0,0);
    vertices[3] = new Point3d(0,0.5,-1);
    vertices[4] = new Point3d(0.4,0.8,0);
    vertices[5] = new Point3d(0.8,-0.8,-1);

          }
      System.out.println("end(TRIANGLE_STRIP);");   // Ende des
TRIANGLE_STRIP

      int[] StripCount = {vertices.length};

            // TriangleStripArray
                  TriangleStripArray tsa = new TriangleStripArray(vertices.length,

GeometryArray.COORDINATES,
                                                                StripCount);

                tsa.setCoordinates(0, vertices);
                      // Shape3D with TriangleStripInformationen
                      Shape3D t = new Shape3D();
                      t.setAppearance(createTriangleAppearance());
                      t.setGeometry(tsa);
                      mouse.addChild(t);
                // end of TriangleStripInformation
                }


Thanks for any hints and tips!

===========================================================================
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