# Re: Question: Visualization of Function with Domain Dimension > 2

```Hi Mike,

Try something like this:

float zplane = ... // the z value of the plane
// first compute the x and y extents of the data
// to get bounds for a Set in the z plane
float xmin = Float.MAX_VALUE;
float xmax = Float.MIN_VALUE;
float ymin = Float.MAX_VALUE;
float ymax = Float.MIN_VALUE;
for (int i=0; i<MAX; i++) {
if (threeDsamples[i] < xmin) xmin = threeDsamples[i];
if (threeDsamples[i] > xmax) xmax = threeDsamples[i];
if (threeDsamples[i] < ymin) ymin = threeDsamples[i];
if (threeDsamples[i] > ymax) ymax = threeDsamples[i];
}
// create the samples for the Set
float[][] plane = new float[NUM * NUM];
int k = 0;
for (int i=0; i<NUM; i++) {
for (int j=0; j<NUM; j++) {
plane[k] = xmin + (xmax - xmin) * i / (NUM - 1.0f);
plane[k] = ymin + (ymax - ymin) * j / (NUM - 1.0f);
plane[k++] = zplane;
}
}
// construct a Gridded3DSet with manifold dimension = 2
// whose N * N samples lie on a plane at z = zplane
Gridded3DSet plane_set
new Gridded3DSet(grid_type.getDomain(), plane, NUM, NUM);
// resample the FlatField to plane_set
FlatField fplane = f.reample(plane_set, Data.WEIGHTED_AVERAGE,
Data.NO_ERRORS);

// now construct a Gridded2DSet in purely (x, y)
float[][] plane2 =  {plane, plane};
RealTupleType xy = new RealTupleType(x, y};
Gridded2DSet xy_set = new Gridded2DSet(xy, plane2,  NUM, NUM);
FuntionType xy_grid_type = new FunctionType(xy, w);
FlatField fxy = new FlatField(xy_grid_type, xy_set);
// copy the range values from fplane to fxy
fxy.setSamples(fplane.getValues());

// now display fxy with MathType ((x, y) -> w)
// and resampling values from the original FlatField on
// the plane z = zplane
x.setData(fxy); // instead of setData(f);

I haven't compiled or run this code, so there may be a few bugs but
the basic idea is right, I think.  Please let me know if you have
problems.

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

```
• 1999 messages navigation, sorted by:
• Search the `visad` archives: