Re: 3D Vector plot

There is a 'setRange(min,max)' method for a ScalarMap, so you could
apply this to your 'wMap' object.  Since you're not using a selectrange
widget on the z axis, you can probably eliminate your 'wRangeMap'.

A suggestion:  when initially exploring data visually, the SpreadSheet
is an excellent tool that allows you to interactively set mappings and
ranges.  In fact, there is a "single cell" of the spreadsheet that
Curtis put together for Jython, but that you can easily get at in java
as well, through visad.python.JPythonMethods.plot(Data, false)  'Data'
is your visad data object, and 'false' will prevent it from trying to
guess at your scalar mappings before display (you'll have to bring up
the "mappings" dialog and choose them.  There are several other
signatures for this method that you might want to look at, too...but I
find this one very handy...

tom

On Fri, 6 Sep 2002, John Osborne wrote:

> The first thing I tried was rotating the plot--it's still just a planar
> vector plot. I have also looked at the wvals and confirmed that they aren't
> 0.0 as well. But if you see nothing wrong in my logic than I must have a 0
> values w component. I'll explicitly set them to a constant and see what
> happens.
>
> oz
>
> Bill Hibbard wrote:
>
> > Hi John,
> >
> > I just tried a quick experiment with a 3-D vector display
> > and it worked OK. To see the Z component of your vectors,
> > you need to rotate the display to look at the vector plane
> > from the side. The only thing I can think of, if you don't
> > see any Z components, is that the wvals in your program
> > are all 0.0.
> >
> > Good luck,
> > Bill
> >
> > On Thu, 5 Sep 2002, John Osborne wrote:
> >
> > > I am trouble producing a 3D vector plot with VisAD. In this case my
> > > u,v,w components are defined on the same x,y grid. What I get is a
> > > plane showing what I assume is the u,v vector inside a 3D cube--can't
> > > see any effect of the w component. Thanks in adbance. This is what I'm
> > > doing:
> > >
> > > X = new RealType(xtypeName, null, null);
> > > Y = new RealType(ytypeName, null, null);
> > > domain_tuple = new RealTupleType(Y, X);
> > > U = new RealType(utypeName, null, null);
> > > V = new RealType(vtypeName, null, null);
> > > W = new RealType(wtypeName, null, null);
> > > range_tuple = new RealTupleType(U, V, W);
> > > func_domain_range = new FunctionType(domain_tuple, range_tuple);
> > >
> > > // Create the domain Set
> > > domain_set = new Linear2DSet(domain_tuple, yArray[0], yArray[ySize-1],
> > > ySize, xArray[0], xArray[xSize-1], xSize);
> > > float[][] set_samples = domain_set.getSamples(true);
> > > float[][] flat_samples = new float[3][xSize * ySize];
> > >
> > > count = 0;
> > > for(int i=0; i < xSize; i++) {
> > >    for(int j=0; j < ySize; j++) {
> > >       double uval = uArray[count];
> > >       double vval = vArray[count];
> > >       double wval = wArray[count];
> > >       flat_samples[0][count] = (float)uval;
> > >       flat_samples[1][count] = (float)vval;
> > >       flat_samples[2][count] = (float)wval;
> > >       count++;
> > >     }
> > > }
> > >
> > > vals_ff = new FlatField(func_domain_range, domain_set);
> > > vals_ff.setSamples(flat_samples, false);
> > >
> > > // A 3D display
> > > display = new DisplayImplJ3D("display1");
> > >
> > > // Create the X,Y ScalarMaps
> > > yMap = new ScalarMap(Y, Display.YAxis);
> > > xMap = new ScalarMap(X, Display.XAxis);
> > > xRangeMap = new ScalarMap(X, Display.SelectRange);
> > > yRangeMap = new ScalarMap(Y, Display.SelectRange);
> > >
> > > // Add X,Y maps to display
> > > display.addMap(yMap);
> > > display.addMap(xMap);
> > > display.addMap(xRangeMap);
> > > display.addMap(yRangeMap);
> > >
> > > // "u" component
> > > uMap = new ScalarMap(U, Display.Flow1X);
> > > uRangeMap = new ScalarMap(U, Display.SelectRange);
> > > display.addMap(uRangeMap);
> > > display.addMap(uMap);
> > >
> > > // "v" component
> > > vMap = new ScalarMap(V, Display.Flow1Y);
> > > vRangeMap = new ScalarMap(V, Display.SelectRange);
> > > display.addMap(vRangeMap);
> > > display.addMap(vMap);
> > >
> > > // "w" component
> > > wMap = new ScalarMap(W, Display.Flow1Z);
> > > wRangeMap = new ScalarMap(W, Display.SelectRange);
> > > display.addMap(wRangeMap);
> > > display.addMap(wMap);
> > >
> > > selXRange = new SelectRangeWidget(xRangeMap);
> > > selYRange = new SelectRangeWidget(yRangeMap);
> > >
> > > // Create a data reference and set the FlatField as our data
> > > data_ref = new DataReferenceImpl("data_ref");
> > > data_ref.setData(vals_ff);
> > >
> > > // Add reference to display
> > >     display.addReference(data_ref);
> > >
> > >
>
>

--
Tom Whittaker
University of Wisconsin-Madison
Space Science and Engineering Center
Cooperative Institute for Meteorological Satellite Studies
Telephone/VoiceMail:  608.262.2759