Re: Delaunay and Java3D

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

Now it gets confusing,
I tried the above setting and I have no scaling any longer, but then
another problem arised:

x,y amd z are the Java3D Axes

these are the following values I have to assigne them, that they are
displayed correctly in my reality:

x -> my "Rechtswert" = "rightvalue" = somewhere around 340000m
y -> my height somewhere around 179m
-z -> my "Hochwert" = "heightvalue" = somewhere around 540000m

thats because, when I want to display terrain, it should look like in
reality, so x is going to the right of my screen, y is going inside the
screen, and the height z is going up.

So  I tried to change the coordinate-values of y and z the following way:

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);
                            double help;
                            for (int i=0;i<point3d.length;i++) {
                                System.out.println("ausgabe");
                                help = point3d[i].y;
                                point3d[i].y=point3d[i].z;
                                point3d[i].z=-help;
                                System.out.println(point3d[i].x);
                                System.out.println(point3d[i].y);
                                System.out.println(point3d[i].z);
                            }
                            geomarr.setCoordinates(0,point3d);
                            System.out.println("ulx "+ulx+"lrx "+lrx+"lry
"+lry+"uly "+uly+"lz "+lz+"uz "+uz);
                        }
                        Shape3D terrain = new Shape3D();

But unfortunately there must be a mistake somewhere, because the Shape3D I
am seeing after this, looks somewhat odd and not right triangulated.
Is it possible to change the coordinates that way?
I thought there would be no difference for the actual Shape3D, because I
do have to do the 2-D-Triangulation with the 540000(x from
Gauss-Krueger-Coordinates Geodesy) and
340000(y from Gauss-Krueger-Coordinates Geodesy) values. And after this
just assigning the right height-values to the triangulation.
Changing the Assignment of the axes for the coordinates afterwards should
not influence the triangulation, as I thought. Maybe I am wrong?

                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});
                    Irregular2DSet set = new Irregular2DSet(xy, new
float[][] {rey, hox});
                    FlatField terrain = new FlatField(terrain_type, set);
                    terrain.setSamples(new float[][] {heights});



Do I have to change the ScalaMap Assignemt? I am not sure!

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

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

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


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


I will try this as well, but I think I will run into the same problem?
> 
> 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.

Again, many many thanks for your help, Desiree

> 


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