Re: Java3D 1.3 Objects vanished AND resampling Irregular2DSet

Hi Desiree,

> 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?

You can construct an Irregular3DSet from your Irregular2DSet using
the appropriate Irregular3DSet constructor signature, but it would
have manifold dimension = 2 (because it is just a 2-D surface
embedded in 3-D). You cannot resample from a 3-D Set with manifold
dimension = 2. But volume rendering is probably not really what you
want here, to get a good visual appearence. Volume rendering creates
a sort of transparent fog, used when the user wants to get an overall
view of volume-filling data. But terrain data lies on a surface
rather than filling a volume, so a crisp terrain surface is better.

To give your terrain "a bit of thickness", perhaps create a second
FlatField with the same domain Set as the first (your Irregular2DSet),
but with z values less than the z values of the first FlatField by
some constant. If you render both FlatFields, it will give two
terrains with the same shape, a small distance apart.

If you are really ambitous you can fill in the gap between the
surfaces by a thin strip around the perimeter, as a Gridded3DSet
with manifold dimension = 2. Its grid dimensions would be:

  2 x number_of_perimeter_points

The tricky part would be finding the perimeter points, in order, of
your original Irregular2DSet.

But if the two surfaces are close together, you may be able to get
away without the strip around the perimeter.

> 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.

This Exception occurs becuase you are casting the Field
returned by resample() as a FlatField. For that you need
an explicit cast, as in 

  FlatField terrain_new = (FlatField) terrain.resample(...);

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html