Re: Contour fitting

Hi Tennessee,

We are making heavy use of contour lines in our applications (hardly
surprising so far) ... A couple of points have come up where we would
like to improve on the way things are done.

Firstly, we find that it is possible to zoom in over an area where no
contour labels are visible. This is undesirable, so we would really like
to force a relabelling of contour lines based on what is currently
visible after every zoom action.

Also, the contour lines are clearly linear lines of best fit. Just
taking a guess, it looks like the contour lines are built by drawing a
straight line until the line of best fit diverges too much from the
data, at which point a new line is started. We would like to use a
smoother line-fitting algorithm, which I suppose would be done by
fitting nonlinear lines of best fit instead.

I'm happy to do the legwork, but am having trouble finding where the
relevant areas of code are. I'd really appreciate an overview of the
contour labelling algorithm and event structure, and also a description
of how the current contour fitting algorithm works.
Bill Hibbard wrote:

Actually, contours are composed of straight lines across
each grid box. Say it is drawing the "10" contour. It finds
two adjacent grid points above and below the value 10, then
find the point on the connecting edge where the grid point
values interpolate to 10. There must be 2 (or 4) edges with
such interpolated 10 points in a grid box, and a straight
line is drawn between them (2 straight lines for 4 points).

Tom Rink greatly improved the contour labels a year or two
ago, so perhaps he can give you some guidance about that.

Much of the code is in visad/Contour2D.java. Also relevant
are the makeContour() method in visad/ShadowType.java and
the makeIsoLines() methods in various visad/*Set.java
classes.

You can do what you want as a custom DataRenderer (see the
tutorial). That way you don't have to change any of the
system's core code.

If you want to make the changes in system core code, then we
will look very closely at what you have done and get pretty
involved in telling you what you can and cannot do.

Good luck,
Bill

The first issue, loosing labels under zoom, we noticed a while ago but
didn't get to it. It's important to us too, and it's probably best left to me.
I'll work it into my current schedule somewhere.

The second issue, smoother contour lines, would be best left, I believe,
to a custom DataRenderer.  My original improvement to VisAD
contours was implemented as a custom renderer, and those classes, which
I'd would be happy to give to you,  might be a good starting point.

Cheers,

TomR



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