Re: Delaunay and Java3D

Hi Desiree,

> I am developing an Java3D Application, where I want to create a
> terrain-surface from discrete Points. I have seen that the API from VisAD
> includes some classes about Delaunay-Triangulation, but I do not have a
> clue, how to use them, or if they can be helpful for me. Where can I find
> more documentation, as in the API or even some examples?
> Thanks for any help in advance.

Assume that the locations of your points are defined in two

  float[] x_locations, y_locations;

and the terrain heights at these points are defined in the

  float[] heights;

Then you can create a terrain as a FlatField like this:

  RealType x = RealType.getRealType("x");
  RealType y = RealType.getRealType("y");
  RealType height = RealType.getRealType("height");
  RealTupleType xy = new RealTupleType(x, y);
  FunctionType terrain_type = new FunctionType(xy, height);

  Irregular2DSet set
    new Irregular2DSet(xy, new float[][] {x_locations, y_locations});
  FlatField terrain = new FlatField(terrain_type, set);
  terrain.setSamples(new float[][] {heights});

Note that the 'new Irregular2DSet' constructor will implicitly
invoke one of the Delaunay constructors to compute a topology
for your x and y locations.  You generally only need to invoke
a Delaunay constructor explicitly when you are constructing a
DealaunayCustom from a known topology.

Please let me know if you have questions about this.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738