Transforming polygonal geometry to TriMesh

Hi,



what is the recommended way of importing polygonal geometry into jme?



the geometry i have consists of several polygon faces of arbitrary points each. in java3d this was an easy task to do, as you have the GeometryInfo class which takes the polygonal geometry and is able to triangulate it.



in jme i could not find a way to get the same thing done. i've found some GeometryInfo class of jme, but this one seems to be pretty old and is not available anymore.

also i have messed around with the Glyph3D and Triangulator classes, which does not work either. as far as i found out by inspecting the code of these two classes, Triangulator seems to work only with x/y planar polygons, not with ones that do have z-coordinates too.



currently i am doing a mix of java3d and jme }:-@, which works well, but definately is not pretty elegant to do so i think.



                GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
      gi.setCoordinates(point_array);
      gi.setStripCounts(strip_count_array);

      NormalGenerator ng = new NormalGenerator();
      ng.generateNormals(gi);

      gi.recomputeIndices();

      int[] coord_indices = gi.getCoordinateIndices();
      Point3f[] coords = gi.getCoordinates();
      javax.vecmath.Vector3f[] normals = gi.getNormals();

      Vector3f[] coords_jme = new Vector3f[coords.length];
      for (int i = 0; i < coords.length; i++)
      {
         coords_jme[i] = new Vector3f(coords[i].getX(), coords[i].getY(), coords[i].getZ());
      }

      Vector3f[] normals_jme = new Vector3f[coords.length];
      for (int i = 0; i < coords.length; i++)
      {
         normals_jme[i] = new Vector3f(normals[i].getX(), normals[i].getY(), normals[i].getZ());
      }



does anyone have a solution to do the same with jme only?

I believe the implementation of the utilities in Java3D is open source by now… you could look at their code and translate it to JME.

One area you may find of interest is creating a mesh using Triangle Strips, it looks like it is doing the same thing here.



There is a test TestTriangleStrip which might help.



if you find the equivalent - a wiki article for converting from java3d to jme will be useful

thanks guys, so it seems there is no ready made solution for a pure jme way of importing polygonal geometry.



sure, i could transfer the java3d classes to jme, but for what … i can use them from the java3d package as they are (java3d is opensource also, as you know).



i guess i will have to leave my (working) code as it is, until some GeometryInfo or Triangulator reappears in jme someday.



anyway, thank you for your thoughts.