Re: how to fill in pixels

Bill-

Bill Hibbard wrote:

"V. Lakshmanan" wrote:

I explicitly turned the texture enabling to true ...
I have put two images on this site, one generated using visad,
and the other using a C++ OpenGL display that illustrates the
problem:
 http://www.nssl.noaa.gov/~lakshman/visad/interpolated.html


Congratulations, Lak, you've uncovered a simple bug that should
have been found 4 years ago and that disabled texture mapping
in your case. The fix (as well as Tom's TextControl fix) is in
the visad.jar and visad_src-2.0.jar files at:

  ftp://ftp.ssec.wisc.edu/pub/visad-2.0/untested/

Please let us know if this doesn't solve your problem.


Using this new version of ShadowFunctionOrSetType, what once
used to (sort of) work, now doesn't.  I'm using the
Radar3DCoordinateSystem and now get an ArrayOutOfBoundsException:

java.lang.ArrayIndexOutOfBoundsException
at ucar.visad.RadarGridCoordinateSystem.toReference(RadarGridCoordinateS
ystem.java:91)
at visad.CachingCoordinateSystem.toReference(CachingCoordinateSystem.jav
a:78)
        at visad.CoordinateSystem.toReference(CoordinateSystem.java:525)
at visad.CoordinateSystem.transformCoordinatesFreeUnits(CoordinateSystem
.java:360)
at visad.CoordinateSystem.transformCoordinatesFreeUnits(CoordinateSystem
.java:500)
at visad.CoordinateSystem.transformCoordinates(CoordinateSystem.java:439
)
at visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.jav
a:1240)
at visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrS
etTypeJ3D.java:100)
at visad.java3d.ShadowFunctionOrSetTypeJ3D.recurseRange(ShadowFunctionOr
SetTypeJ3D.java:986)
at visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.jav
a:2914)
at visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrS
etTypeJ3D.java:100)
at visad.java3d.DefaultRendererJ3D.doTransform(DefaultRendererJ3D.java:9
8)
        at visad.java3d.RendererJ3D.doAction(RendererJ3D.java:177)
        at visad.DisplayImpl.doAction(DisplayImpl.java:1504)
        at visad.ActionImpl.run(ActionImpl.java:303)
        at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:95)

If I revert back to the previous version, it works fine (except
for the textureMapping not working correctly). RadarGridCoordinateSystem
is attached.  It looks like the 3 dimensional array it is expecting
(lat, lon, elevation) is coming in as a 2 dimensional array (lat, lon)?

I always wondered why the textureMapping didn't work for this data, so
now I guess I know why.

Don


/******************************************************************************
 $Id: RadarGridCoordinateSystem.java,v 1.1 2002/05/10 14:08:02 dmurray Exp $
 
 Copyright © 1997-2002 Unidata Program Center/University Corporation for
 Atmospheric Research, P.O. Box 3000, Boulder, CO 80307,
 support@xxxxxxxxxxxxxxxx.
 
 This library is free software; you can redistribute it and/or modify it
 under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation; either version 2.1 of the License, or (at
 your option) any later version.
 
 This library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
 General Public License for more details.
 
 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
*******************************************************************************/

package ucar.visad;

import visad.*;
import visad.georef.EarthLocation;
import visad.georef.NavigatedCoordinateSystem;
import ucar.unidata.geoloc.Bearing;
import ucar.unidata.geoloc.LatLonPointImpl;
import visad.bom.Radar3DCoordinateSystem;

/**
 * Class to transform lon/lat/elevation angle to lon/lat/altitude
 *
 * @author MetApps Development Team
 * @version $Revision: 1.1 $ $Date: 2002/05/10 14:08:02 $
 */
public class RadarGridCoordinateSystem 
    extends NavigatedCoordinateSystem 
{

    private static Unit[] units = { CommonUnit.degree,
                                    CommonUnit.degree,
                                    CommonUnit.degree };

    private Radar3DCoordinateSystem rcs = null;
    private LatLonPointImpl center = null;
    private LatLonPointImpl workLL = new LatLonPointImpl();

    /**
     * Construct a new RGCS with the center point
     * @param  radLocation  radar location (lat/lon/alt)
     * @throws VisADException couldn't create necessary VisAD objects
     */
    public RadarGridCoordinateSystem(EarthLocation radLocation) 
      throws VisADException {
        this(radLocation.getLatitude().getValue(CommonUnit.degree),
             radLocation.getLongitude().getValue(CommonUnit.degree),
             radLocation.getAltitude().getValue(CommonUnit.meter));
        
    }

    /**
     * Construct a new RGCS with the center point
     * @param  lat  radar latitude
     * @param  lon  radar longitude
     * @param  alt  radar altitude
     * @throws VisADException couldn't create necessary VisAD objects
     */
    public RadarGridCoordinateSystem(double lat, double lon, double alt)
      throws VisADException {

        super(RealTupleType.SpatialEarth3DTuple, units);
        center = new LatLonPointImpl ( lat, lon);
        rcs = new Radar3DCoordinateSystem( (float)lat, (float)lon, (float)alt);
    }

    public double[][] toReference(double[][] lonlatelev) 
        throws VisADException {
        int numPoints = lonlatelev[0].length;
        double[][] latlonalt = new double[3][numPoints];
        for (int i = 0; i < numPoints; i++) {

            workLL.setLatitude(lonlatelev[1][i]);
            workLL.setLongitude(lonlatelev[0][i]);
            Bearing result = Bearing.calculateBearing(center, workLL, null);
            latlonalt[0][i] = result.getDistance()*1000;
            latlonalt[1][i] = result.getAngle();
            latlonalt[2][i] = lonlatelev[2][i];
            // latlonalt should now be range/azimuth/elevation
        }
        latlonalt = rcs.toReference(latlonalt);
        return new double[][] { latlonalt[1], latlonalt[0], latlonalt[2]};
    }

    public double[][] fromReference(double[][] lonlatalt) 
        throws VisADException {
        int numPoints = lonlatalt[0].length;
        double[][] lonlatelev = rcs.fromReference(
            new double[][] { lonlatalt[1], lonlatalt[0], lonlatalt[2]});
        for (int i = 0; i < numPoints; i++) {
            lonlatelev[0][i] = lonlatalt[0][i];
            lonlatelev[1][i] = lonlatalt[1][i];
        }
        return lonlatelev;
    }

    public boolean equals(Object obj) {
       if (!(obj instanceof RadarGridCoordinateSystem)) return false;
       RadarGridCoordinateSystem that = (RadarGridCoordinateSystem) obj;
       return this == that || center.equals(that.center);
    }
}
  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: