Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Any chance I could get another helpful nudge? Here's my embryonic hex.java - trying to display a single hexahedral cell (as 5 tetrahedra) via Irregular3DSet (this will be the case, in general). All I see is the reference box when I run this. I'd like to display the grid itself, then later scalar data over the grid. thanks, --Randy // import needed classes import visad.*; import visad.java3d.DisplayImplJ3D; import visad.util.VisADSlider; import java.rmi.RemoteException; import java.io.IOException; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class hex { // type 'java cbay' to run this application public static void main(String args[]) throws VisADException, RemoteException, IOException { // Define vertices float vtx[][] = new float[3][8]; int k=0; // front face vtx[0][k]= -0.7f; vtx[1][k]= -0.3f; vtx[2][k]= -0.5f; k++; vtx[0][k]= 0.7f; vtx[1][k]= -0.3f; vtx[2][k]= -0.5f; k++; vtx[0][k]= 0.7f; vtx[1][k]= 0.3f; vtx[2][k]= -0.5f; k++; vtx[0][k]= -0.7f; vtx[1][k]= 0.3f; vtx[2][k]= -0.5f; k++; // back face vtx[0][k]= -0.7f; vtx[1][k]= -0.3f; vtx[2][k]= 0.5f; k++; vtx[0][k]= 0.7f; vtx[1][k]= -0.3f; vtx[2][k]= 0.5f; k++; vtx[0][k]= 0.7f; vtx[1][k]= 0.3f; vtx[2][k]= 0.5f; k++; vtx[0][k]= -0.7f; vtx[1][k]= 0.3f; vtx[2][k]= 0.5f; k++; // Define tetrahedra // int numTetra = 5 * numHexCells; int numTetra = 5; int tetra[][] = new int[numTetra][4]; k=0; tetra[k][0]=0; tetra[k][1]=2; tetra[k][2]=7; tetra[k][3]=3; k++; tetra[k][0]=0; tetra[k][1]=2; tetra[k][2]=5; tetra[k][3]=7; k++; tetra[k][0]=0; tetra[k][1]=5; tetra[k][2]=1; tetra[k][3]=2; k++; tetra[k][0]=0; tetra[k][1]=5; tetra[k][2]=4; tetra[k][3]=7; k++; tetra[k][0]=7; tetra[k][1]=2; tetra[k][2]=6; tetra[k][3]=5; k++; Irregular3DSet set = new Irregular3DSet( MathType.stringToType("Set(x, y, z)"), vtx, null, // CoordinateSystem null, // Unit[] null, // ErrorEstimate[] new DelaunayCustom(vtx, tetra) ); DataReferenceImpl ref = new DataReferenceImpl("set"); ref.setData(set); // link set to ref // create a Display using Java3D DisplayImplJ3D display = new DisplayImplJ3D("set display"); RealTupleType tuple = ((SetType) set.getType()).getDomain(); RealType x = (RealType) tuple.getComponent(0); RealType y = (RealType) tuple.getComponent(1); RealType z = (RealType) tuple.getComponent(2); display.addMap(new ScalarMap(x, Display.XAxis)); display.addMap(new ScalarMap(y, Display.YAxis)); display.addMap(new ScalarMap(z, Display.ZAxis)); display.addReference(ref); // link ref to display // create JFrame (i.e., a window) for display and slider JFrame frame = new JFrame("Hex Cell"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); // create JPanel in JFrame JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); frame.getContentPane().add(panel); // add slider and display to JPanel // panel.add(slider); panel.add(display.getComponent()); // set size of JFrame and make it visible frame.setSize(400, 400); frame.setVisible(true); } }
visad
archives: