Re: Delaunay and Java3D




> 
> I'm not sure, but this looks like a bug in Java3D, since you
> are calling branchGroup.detach() before you add() its descendant
> Shape3D to another scene graph.  You may need to get the
> GeometryArray from the Shape3D and copy its coordinates, normals
> and colors into a new GeometryArray and put that in a new Shape3D.
> I think the GeometryArray will be a TriangleStripArray.


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:

Messstelle mit ID 246539
y  Rechtswert: 3549415
x  Hochwert:   5496636
z    Gelaendehoehe [m]: 179.35

Messstelle mit ID 286032
  Rechtswert: 3547115
  Hochwert:   5502025
    Gelaendehoehe [m]: 171.06

Messstelle mit ID 306035
  Rechtswert: 3546710
  Hochwert:   5501795
    Gelaendehoehe [m]: 171.0

Messstelle mit ID 20096031
  Rechtswert: 3548125
  Hochwert:   5498345
    Gelaendehoehe [m]: 175.0

Messstelle mit ID 20176037
  Rechtswert: 3547638
  Hochwert:   5500060
    Gelaendehoehe [m]: 174.0

Messstelle mit ID 20186032
  Rechtswert: 3547949
  Hochwert:   5499551
    Gelaendehoehe [m]: 174.9

Messstelle mit ID 20196038
  Rechtswert: 3546885
  Hochwert:   5497250
    Gelaendehoehe [m]: 189.2

but the GeometryArray from the Shape3D has the following Point3d-Objects:
Wich kind of Transformations are done by the VisAD Delaunay Triangulation?
Is it possible to get rid of them? Or how do I get my original coordinates
back?

Again, many thanks for your patient help, Desiree 

ausgabe
x 1.0
y -0.7005545496940613
z -0.9934068322181702
ausgabe
0.9146409630775452
-1.0
-1.0
ausgabe
0.2707366943359375
-0.31386321783065796
-0.6703296303749084
ausgabe
-0.7721284031867981
-0.8706099987030029
1.0
ausgabe
0.0818333625793457
-0.08391866832971573
-0.5714291930198669
ausgabe
-0.36574503779411316
0.046210721135139465
-0.5604394674301147
ausgabe
-1.0
1.0
-0.08241675794124603
ausgabe
-1.0
1.0
-0.08241675794124603
ausgabe
-1.0
1.0
-0.08241675794124603
ausgabe
-1.0
1.0
-0.08241675794124603
ausgabe
-0.36574503779411316
0.046210721135139465
-0.5604394674301147
ausgabe
-0.7721284031867981
-0.8706099987030029
1.0
ausgabe
-0.7721284031867981
-0.8706099987030029
1.0
ausgabe
0.2707366943359375
-0.31386321783065796
-0.6703296303749084
ausgabe
0.2707366943359375
-0.31386321783065796
-0.6703296303749084
ausgabe
0.0818333625793457
-0.08391866832971573
-0.5714291930198669
ausgabe
1.0
-0.7005545496940613
-0.9934068322181702
ausgabe
-1.0
1.0
-0.08241675794124603

VisAD part of my program:

System.out.println("Hallo Delaunay!");
                RealType x = RealType.getRealType("x");
                RealType y = RealType.getRealType("y");
                RealType height = RealType.getRealType("height");
                try {
                    RealTupleType xy = new RealTupleType(x, y);
                    FunctionType terrain_type = new FunctionType(xy,
height);
                    Irregular2DSet set
                    new Irregular2DSet(xy, new float[][] {hox, rey});
                    FlatField terrain = new FlatField(terrain_type, set);
                    terrain.setSamples(new float[][] {heights});

                    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);

                    DataReferenceImpl data_ref = new
DataReferenceImpl("data_ref");              
                    data_ref.setData( terrain );
                    renderer = new DefaultRendererJ3D();
                    display.addReferences(renderer,data_ref);

                    DisplayListener listener = new
TerrainListener(renderer,gisTerm);
                    display.addDisplayListener(listener);

                }
                catch (VisADException ve) {
                    System.out.println("VisAd TupleType Exception");
                }       
                catch (RemoteException re) {
                    System.out.println("RemoteExcpetion");
                }
                System.out.println("Delaunay ende!");


public void displayChanged(DisplayEvent e) {
        if (e.getId() == DisplayEvent.TRANSFORM_DONE) {
            BranchGroup branchGroup = renderer.getBranch();
            branchGroup.detach();
            Enumeration enum = branchGroup.getAllChildren();
            System.out.println(branchGroup);
            while(enum.hasMoreElements()) {
                Object o;
                o = enum.nextElement();
                if (o instanceof Shape3D) {
                    System.out.println((Shape3D) o);
                    Shape3D shape3d = (Shape3D) o;
                    Geometry geom = shape3d.getGeometry();
                    if (geom instanceof GeometryArray) {
                        System.out.println("GeometryArray");
                        GeometryArray geomarr = (GeometryArray) geom;
                        Point3d[] point3d = new Point3d[18];
                        for (int i=0;i<point3d.length;i++) {
                            point3d[i]= new Point3d();
                        }
                        geomarr.getCoordinates(0,point3d);
                        for (int i=0;i<point3d.length;i++) {
                            System.out.println("ausgabe");
                            System.out.println(point3d[i].x);
                            System.out.println(point3d[i].y);
                            System.out.println(point3d[i].z);
                        }
                    }
                    Shape3D terrain = new Shape3D();
                    Appearance app = shape3d.getAppearance();
                    terrain.setGeometry(geom);
                    terrain.setAppearance(app);
                    // GIS3DView machen und fuellen
                    GIS3DView gis3dView = new GIS3DView(true);
                    Layer3D layer3d = new Layer3D();
                    layer3d.addShape(terrain);
                    gis3dView.addLayer(layer3d);

                    JTabbedPane p = gisTerm.getTabbedPane();
                    System.out.println("nach get tap");
                    p.add("VisAD",gis3dView);
                    p.setSelectedComponent(gis3dView);
                }
            }
        }
    }

> 
> Cheers,
> Bill
> ----------------------------------------------------------
> Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
> hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
> http://www.ssec.wisc.edu/~billh/vis.html
>