Re: Delaunay and Java3D

Hi Desiree,

> Ok, hi I managed to get the Geometry and put it into a new Shape3D and
> displayed it. I was very happy, when I could see your surface in mine
> "GIS3DView"!
> Unfortunately it is not in the right place.
> I am displaying my other objects directly at their world coordinates.
> For example the surface I developed with VisAD has the following vertices:

VisAD scales values from data coordinates to display
coordinates.  The default scales x, y and z all to be
in the range between -1.0 and 1.0.  But it is easy to
change the default as follows:

>                     display = new DisplayImplJ3D("display1");
>                     ScalarMap hoxmap = new ScalarMap(x, Display.XAxis);
>                     ScalarMap reymap = new ScalarMap(y, Display.YAxis);
>                     ScalarMap heightmap = new ScalarMap(height,
> Display.ZAxis);
>                     display.addMap(hoxmap);
>                     display.addMap(reymap);
>                     display.addMap(heightmap);

Just add the following statements:

  hoxmap.setRange(-1.0, 1.0);
  reymap.setRange(-1.0, 1.0);
  heightmap.setRange(-1.0, 1.0);

This says scale -1.0 to -1.0 and 1.0 to 1.0, so the scaling
is the identity.  That is, no scaling.

It has occurred to me that there is another way to do what
you want:

  RealType x = RealType.getRealType("x");
  RealType y = RealType.getRealType("y");
  RealType height = RealType.getRealType("height");
  try {
    RealTupleType xy = new RealTupleType(x, y);
    Irregular2DSet set = new Irregular2DSet(xy, new float[][] {hox, rey});
    float[][] samples = {hox, rey, heights};
    RealTupleType xyh = new RealTupleType(x, y, height);
    Irregular3DSet new_set = (Irregular3DSet)
      set.makeSpatial(xyh, samples);
    VisADTriangleStripArray array = new_set.make2DGeometry(null, false);

This is essentially what happens inside the DisplayImplJ3D.
I haven't tried this so can't be sure it will work, but
thought I'd pass it on.

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

  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: