Re: Java3D 1.3 Objects vanished AND resampling Irregular2DSet

Hi Desiree,

> > The lines will have to come from Data that makes lines, such
> > as a Set with manifold dimension = 1 or a FlatField with a
> > domain Set with manifold dimension = 1 (the lines don't look
> > like iso-lines).
> 
> 1. In the attached test case (LineTest2) I added a line to my view. In
> that example I
> just put the height values in, but how could I calculate the real
> values. In the example I would need the height values of the
> Irregular2DSet set for example at a specific x or y position.

By resampling from the terrain FlatField.

> 2. Additionaly I am not only interested in profiles parallel to x and y. I
> am also interestes in profiles along a line through the x,y plane.

Resample the terrain FlatField to a Set over the (x, y) domain
with manifold dimension = 1 (a line or curve).

> 3. I tried to create a ConstantMap with a derivation of a xheight
> Irregular2DSet. That one is giving me the shape of the layer from the
> side. Thats unforetunately not what I want as well.
> Sorry, I think I am still digging in the wrong direction.
> 
> Given such Data, you can make thick lines
> > with ConstantMaps to LineWidth. You can put each set of lines
> > on a different ZAxis level with ConstantMaps to ZAxis.
> 
> Or if
> > you want line z level to vary with terrain, you can resample
> > your terrain FlatField to Sets over the (x, y) domain and with
> > manifold dimension = 1. These resample() calls will produce
> > FlatFields, and you can adjust their z level (to create distinct
> > layers) by adding offsets to their getFloats() values, then
> > passing back to their setSamples() methods.
> 
> Hm, I tried something:
> 
>         Linear1DSet set1D = new Linear1DSet(x,0,15,5);
>         FlatField terrain_new
> (FlatField) terrain.resample(set1D,Data.WEIGHTED_AVERAGE,Data.NO_ERRORS);
> 
> That gives me the following error:
> 
> Exception in thread "main" visad.SetException: FlatField.resample: bad Set
> Dimen
> sion
>         at visad.FlatField.resample(FlatField.java:3260)
>         at LineTest3.<init>(LineTest3.java:88)
>         at LineTest3.main(LineTest3.java:166)
> 
> Is there an example somewhere, where something similar is done?
> Can I resample a thing with 2 dimension to one with 1 dimension? See
> LineTest3.java
> I have still to create 2 dimensions, right? But where do I get the
> manifold dimension 1?

You need to resample to a Set over the (x, y) domain. Your set1D is only
over the x domain. Use the Gridded2DSet constructor:

  public Gridded2DSet(MathType type, float[][] samples, int lengthX)

with samples dimensioned float[2][number_of_samples], with
type = new RealTupleType(x, y), and with lengthX = number_of_samples.
Note in the sample array you will supply two values for each sample,
namely its x and y coordinates. You can use this to describe a line or
curve in the (x, y) plane.

Good luck,
Bill