Re: Delaunay and Java3D

Hi Bill and others,

I expierience often troubles with my coordinate systems.

Java3D has      x right
                y up
                z to the viewer

My world coordinates should be          x right rechts
                                        y into the screen hoch
                                        z up


Now I was wondering about DisplayImplJ3D.

The following is  a piece of code in my terrain-creating class, which is
using VisAD:

        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);
            display.addDisplayListener(listener);       

In which direction are the Display.XAxis, Display.YAxis and Display.ZAxis
looking of the DisplayImplJ3D?

Thanks for your help again, Desiree


o------------------------------------------------------------------------o
| Desiree Hilbring      Institut fuer Photogrammetrie und Fernerkundung  | 
|                       Universitaet Karlsruhe, Germany                  |
|                                                                        |
|                       email: hilbring@xxxxxxxxxxxxxxxxxxxx             |
|                       # 0721 6083676                                   |
o------------------------------------------------------------------------o

On Thu, 24 Aug 2000, Bill Hibbard wrote:

> Hi Desiree,
> 
> > 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.
> 
> In Java3D with an identity projection matrix you should have
> x increasing to the right, y increasing upward and z increasing
> out of the screen (toward the viewer).  This is consistent with
> your directions, with a 90 degree rotation in the matrix.
> 
> > 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?
> 
> You are right, swapping coordinates will not change the
> triangulation.
> 
> I cannot see any error in what you are doing, but often face
> similar mysteries in my own work.  All you can do is experiment
> with different permutations and print out a lot of numbers,
> trying to understand the relation with the picture, until you
> solve it.
> 
> Good luck,
> 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
> 


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