Re: An interpolation question...

Hi Carlos,

> I`ve got another question regarding VisAD, and I think it`s the last one, so 
> I`ll stop boring all of you with my stupid questions... ;-)
> 
> Ok. For example, I have a DisplayImplJ2D, and a Set of Data, maybe a 
> Linear2DSet, with 10x8 samples of data. That data represents the
> temperature value, which I map to RGB when I include it to the Display. So I 
> can visualize a beatiful RGB shade in my display. But , since
> I`ve got only 80 values of temperature (remember it was 10x8) and the 
> visualized shade is "linear" (a whole surface is displayed, not only the
> 80 points), how is that surface displayed? How does VisAD calculate all the 
> rest of the values? I suppose it use some kind of interpolation
> algorithm, so, what algorithm is it? Can I choose another one? Which 
> algorithms can I use?

Interpolation happens in a number of ways:

1. If you display your 10x8 FlatField using texture mapping (the
default), each of the 80 grid boxes will be displayed as a solid
color rectangle (warped rectangle if you are using a map
projection). In this case there is no interpolation.

2. If you disable texture mapping by calling
GraphicsModeControl.setTextureEnable(false), then your 10x8
Field will be displayed as a set of 160 triangles, with linear
interpolation of colors across each triangle.

3. If you care about the interpolation algorithm, you can
construct a higher resolution Set (e.g., 100x80) and pass
it to the resample() method of your 10x8 FlatField. The
default interpolation for existing VisAD Set classes is
linear for lines, triangles and tetrahedra, bilinear for
rectangles, and trilinear for rectangular solids. However,
you are free to extend the existing Set classes and override
the implementation of the valueToInterp() method, in which
you can return whatever set of weights you like for the
weighted average interpolation. By choosing weights
appropriately, you can define any degree of polynomial
interpolation or even a one-stage Barnes of Cressman
interpolation. Note you would use your new Set class as
the domain Set of your original 10x8 FlatField (rather
than the Set you pass to its resample() method), since
it is the data being interpolated. Once you get the data
resampled to a higher resolution, then display it either
with or without texture mapping.

4. Another approach would be to define a new extension
of the DataRenderer class (no day at the beach, but the
DataRenderer tutorial can help) to render your 10x8 data
in what ever way you like.

Good luck,
Bill


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