> At the moment we are using bom/FlexibleTrackManipulation.java
> to plot cyclone locations, and another class I wrote to draw straight
> lines between these points.
> Some forecasters aren't happy with just imagining curvy lines
> in between, they want them drawn that way.
> My plan is to create extra points between the cyclone locations,
> which are along a quadratic which passes through the cyclone locations,
> and then draw straight lines between them.
> Is there anything in Visad that already helps do this? I think
> there is some spline stuff in there, but I've got no idea what it
> does. I'd like to use any infrastructure that already exists.
> I would also probably need to do some projectionControl listening
> to figure out how many points to insert between the cyclone locations.
> Is that the best way? I suspect it gives a visual lag, which is not
> apparent in your front drawing stuff, which seems similar. Is it's
> method relevent here?
The code in visad/paoloa/spline uses native code for the heavy
math. And it was written by Paolo Antonelli so I don't know
much about it. There is also some 2-D spline code for satellite
image navigation, but it would be hard to adapt. If you need
spline code, its probably best to just write your own.
However, there is some code in visad/bom/FrontDrawer.java that
may help you. It basically smooths a hand drawn curve (in a
Gridded2DSet with manifold dimension = 1) as follows (with
some code editing for clarity):
curve_samples = curve_set.getSamples(false);
float curve = new float;
// convert (lat, lon) curve to (x, y) graphics coordinates
curve = lat_map.scaleValues(curve_samples[lat_index]);
curve = lon_map.scaleValues(curve_samples[lon_index]);
// lowpass filter curve
curve = smooth_curve(old_curve, fw);
// resample smoothed curve
curve = resample_curve(curve, increment);
Rather than using a ProjectionControl, it simply uses
ScalarMap.scaleValues() to convert (lat, lon) values to
(x, y) graphics values and does its smoothing work in
those coordinates. The smooth_curve() method is a simple
low pass filter, and the resample_curve() method resamples
to evenly spaced samples.
You could experiment with various combinations of
resampling and smoothing, and possibly also spline
fitting, to get the desired behavior.
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706
hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738