NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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); > >
visad
archives: