Re: how to fill in pixels


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

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:

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:

at ucar.visad.RadarGridCoordinateSystem.toReference(RadarGridCoordinateS
at visad.CachingCoordinateSystem.toReference(CachingCoordinateSystem.jav
        at visad.CoordinateSystem.toReference(
at visad.CoordinateSystem.transformCoordinatesFreeUnits(CoordinateSystem
at visad.CoordinateSystem.transformCoordinatesFreeUnits(CoordinateSystem
at visad.CoordinateSystem.transformCoordinates(
at visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.jav
at visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrS
at visad.java3d.ShadowFunctionOrSetTypeJ3D.recurseRange(ShadowFunctionOr
at visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.jav
at visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrS
at visad.java3d.DefaultRendererJ3D.doTransform(
        at visad.java3d.RendererJ3D.doAction(
        at visad.DisplayImpl.doAction(
        at visad.util.ThreadPool$

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.


 $Id:,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,
 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
 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;

 * 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 = {,

    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 {

     * 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++) {

            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(;