Re: Aspect of 2D-Displays


I assume Timo is having the same problem I have. If I change the aspect
ratio, axis labels, wind vectors, and other Shapes are "stretched" out
of shape. This is not acceptable behavior so I am unfortunately stuck
with using a square box. I need to have the ability to set the aspect
ratio without the result being a square stretched to fit.

How hard would it be to implement an aspect ratio that is independent of
the projection matrix? (Am I correct in assuming that the box is defined
by -1 to 1 and the aspect is manipulated by the transformation matrix?)
I envision a box defined by -1 to 1 along one dimension and, say, -2 to
2 in another to provide the desired aspect ratio (2 to 1 in this case).
I'm not familiar with the transformation math enough to know if this
would work.  


Curtis Rueden wrote:
> Hi Timo,
> If you are looking for a one-to-one correspondence between data samples
> and onscreen pixels, that is a bit tricky.  However, fitting the data
> aspect to the shape of the display window is not as hard.
> You are not the first person to request such a feature in VisAD, so I
> added a method setAutoAspect(boolean auto) to DisplayImplJ2D.  If you
> call setAutoAspect(true) on a DisplayImplJ2D object, the aspect will
> automatically adjust to fit the window every time the display panel
> changes size.
> The updated classes should be available on the FTP server within a few
> days.  In the meantime, you can find the two relevant files at
> Just put these two files in visad/java2d and recompile.
> Curtis
> At 06:42 11/14/00, you wrote:
> >Hi,
> >
> >I have (IMO) a very simple problem with the axis scaling in 2D-Displays.
> >Unfortunatly the manual couldn't help me much with it. The problem:
> >
> >How to set the aspect of an DisplayImpl2JD such that it covers an
> >rectangular area on the screen without strechting all pixels (which it
> >does if use ProjectionControl.setAspect())? At the moment the plot is
> >always a square even if I change the window size to a rectangle (the
> >Display automatically adjusts itself to the minimum of the width and
> >height). The perfect behaviour would be an automatic fitting to the
> >window size by covering the full available area.
> >Anybody out there who knows about that?
> >
> >Regards,
> >Timo
> >--
> >__.__________
> > |lmo |homas

| Doug Lindholm, Software Engineer          |  E-mail: lind@xxxxxxxx   |
| Research Applications Program             |   Phone: 303-497-8374    |
| National Center for Atmospheric Research  |                          |
| P.O. Box 3000                             |     There's no place     |
| Boulder, Colorado 80307-3000              |        like $HOME        |