Re: Why the displays are different in J2D and J3D( with 2D renderer)?

  • To: Y YI <yyi@xxxxxxx>
  • Subject: Re: Why the displays are different in J2D and J3D( with 2D renderer)?
  • From: Bill Hibbard <billh@xxxxxxxxxxxxx>
  • Date: Tue, 10 Jun 2003 16:15:45 -0500 (CDT)
Hi Helen,

> I have a grid data set which is in McIDAS GRID format with 20 rows and 28 
> columns.
>
> Using the following codes, I got 4  displays shown at  URL
> http://enso.larc.nasa.gov/~helen/.
>
> When rendering  the displays in X_Y domain (case 'a' and 'c'), they
> looks similar using either DisplayImplJ2D or DisplayImplJ3D.
>
> But the displays in Lat_Lon domain (case 'b' and 'd') are shown differently 
> in J2D and J3D. The display (case 'b') generated in DisplayImplJ2D and  
> Lat_Lon domain looks very strange. Where and how do
> the triangles come from? How can I fix it?

This difference is because Java2D does not support curved
texture maps. 'b' and 'd' don't look curved because your
CoordinateSystem is linear, but VisAD has to assume that
CS's are non-linear (i.e., curved). Do whenever a curved
texture map is necessary in Java2D, VisAD displays the data
as a bunch of triangles instead. The only thing you can do
about is to resample() your data before display to a FlatField
with MathType ((lat, lon) -> Grid) and a Linear2DSet domain
Set, then display the FlatField returned by resample(). It
will be texture mapped in Java2D.

> In addition,  the display of grids at 4 edges and 4 corners (case 'd') are 
> been
> trimmed, that is, only half grid or quarter of grid is displayed.  How
> can I get a display, which is  showing full grid on the edges, in
> LAT_LON domain?

VisAD tries to place the centers of pixels in accurate locations.
This puts the centers of corner pixels at the corners of the display
box. In some cases, the parts of the pixels outside the box are
visible and in some cases they are not (for reasons that have to do
with properties of Java2D versus Java3D and texture mapping versus
triangular geometry). The solution here is similar to above.
resample() your grid to a FlatField with MathType
((lat, lon) -> Grid) and a Linear2DSet domain Set.

Good luck,
Bill


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