Re: Java3D 1.3 Objects vanished AND resampling Irregular2DSet

> > > However, are you saying that you do not have this problem
> > > under Java3D version 1.2?
> > 
> > Yeah, thats true.
> 
> Then you may want to report this to the java3d-interest@xxxxxxxxxxxx
> mailing list.

I did in the meantime and I will try to create a small testcase. In the
meantime I managed to revisualize the objects in just grabbing the
geometry and putting it into a new object.

But now I have another question.

I am creating a terrain-like shape with an Irregular2DSet. What I want to
do now is give that terrain a bit of thickness. So I guess I have to do
Volume Rendering. I understand that I have to use a Linear3DSet for
VolumeRendering. In one of your messages you mentioned that it is possible
to resample other fields into a Linear3DSet. How would I resample my
Irregular2DSet. I think I am missing a dimension here. Can I enlarge my
FlatField from the Irregular2DSet?

I am attaching a TestCase, which includes an examples for my
Irregular2DSet. And I tried to resampled it into in Linear3DSet, but the
compiler give me the following message:

VolumeTest5.java:55: incompatible types
found   : visad.Field
required: visad.FlatField
        FlatField terrain_new
terrain.resample(set,Data.WEIGHTED_AVERAGE,Data.NO_ERRORS);

But the API of FlatField waits for an Set and Linear3DSet is a Set.
Sorry, I am confused.


Thanks for your help.

Desiree
// Import needed classes

import visad.*;
import visad.util.*;
import visad.java3d.DisplayImplJ3D;
import java.rmi.RemoteException;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;




public class VolumeTest5{

    private RealType x,y,height;
    private RealType layerVal;
    
    private RealTupleType xy;
    
    private FunctionType terrain_type;
        
    private Set set;
    
    //private FlatField terrain;
    
    private DataReferenceImpl data_ref;
    
    private DisplayImpl display;
    private ScalarMap hoxmap,reymap,heightmap;
    
    public VolumeTest5(String []args)
        throws RemoteException, VisADException {
        
        RealType x = RealType.getRealType("x");
        RealType y = RealType.getRealType("y");
        RealType height = RealType.getRealType("height");
        
        xy = new RealTupleType(x, y);
        
        terrain_type = new FunctionType( xy, height);

        float[] eastValues = {1,2,7,7,13};
        float[] northValues = {3,8,1,6,3};
        float[] heightValues = {1,2,1,2,1};

        set = new Irregular2DSet(xy,new float[][] {eastValues, northValues});
        
        // Create a FlatField
        // Use FlatField(FunctionType type, Set domain_set)
        
        FlatField terrain = new FlatField( terrain_type, set);

        Linear3DSet set = new Linear3DSet(1,13,5,3,8,5,1,2,5);
        FlatField terrain_new = 
terrain.resample(set,Data.WEIGHTED_AVERAGE,Data.NO_ERRORS);
        
        terrain.setSamples(new float[][] {heightValues});
        
        display = new DisplayImplJ3D("display1");
        
        GraphicsModeControl dispGMC = (GraphicsModeControl)  
display.getGraphicsModeControl();
        dispGMC.setScaleEnable(true);
        
        hoxmap = new ScalarMap( x, Display.XAxis );
        reymap = new ScalarMap( y, Display.YAxis );
        heightmap = new ScalarMap( height, Display.ZAxis );
        
        display.addMap( hoxmap );
        display.addMap( reymap );
        display.addMap( heightmap );
        
        data_ref = new DataReferenceImpl("data_ref");
        
        data_ref.setData( terrain );
        
        display.addReference( data_ref );
        
        
        // Create application window and add display to window
        JFrame jframe = new JFrame("VolumeTest5");
        jframe.getContentPane().add(display.getComponent());
        
        
        // Set window size and make it visible
        jframe.setSize(300, 300);
        jframe.setVisible(true);
    }
    
    
    public static void main(String[] args)
        throws RemoteException, VisADException
    {
        new VolumeTest5(args);
    }
    
}
  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: