Quoc Huynh schrieb:

> Hi All,
>
>         I just wanted to know what is the best approach at drawing an elevation grid?
>
>         I have a 250x213 matrix contain heights... an (x,y) matrix. with the
> height as the z component. I have no further information.
>
>         I'm looking at using the trianglestrip geometry array, however, does this
> mean i need to create a trianglestrip array for each row of my grid??...
> this would also mean i will be reproducing some shared points between
> triangle strips???
>
>         does anyone know a better approach to this?????

i use an array[i][j] with values as y coordinates and i, j mapped to x, z.
i then transfer the data into an quad array
( a quad for evrey 4 data points [i][j], [i+1][j],[i+1][j+1],[i][j+1])
this results in a lot of vertices, of course!

code excerpt:

.
.
.
      tmp = new Point3d();
      quads = new QuadArray(nverts,
quads.COORDINATES|quads.ALLOW_COORDINATE_WRITE|quads.COLOR_4);
      // set the quads coordinates per vertex
      for(i=0; i<nx-1; i++)
        for(j=0; j<ny-1; j++, li+=4)
        { tmp.set((double) i, (double) data[i][j], (double) j);
          quads.setCoordinate(li, tmp);
          tmp.set((double) i+1, (double) data[i+1][j], (double) j);
          quads.setCoordinate(li+1, tmp);
          tmp.set((double) i+1, (double) data[i+1][j+1], (double) j+1);
          quads.setCoordinate(li+2, tmp);
          tmp.set((double) i, (double) data[i][j+1], (double) j+1);
          quads.setCoordinate(li+3, tmp);
        }
.
.
.


resuzlts can look like this (attachment: just the blue/yellow surface)

greetings
maik lutterklas




PNG image

Reply via email to