Hi Cuong Chau,
> My apologies if this was not a recommended practice to ask question regarding
> the usage of VISAD. Firstable let me thank you and your colleagues to provide
> such a useful tool. I was looking for some sort of utility to plot a 3D curve
> and was ecstatic to find your tool. I have a very simple plotting problem but
> have spent about a week going through various VISAD tutorial and samples but
> still couldn't find an anwser for it. Basically, I would like to produce a
> plot that represent this relationship (x,y) -> z. The x axis in my case will
> be an 5 element array and 10 elements for the y axis. My question is how do I
> represent them using the Gridded2DSet. In one of the samples that shipped
> with
> VISAD, somebody gave the following instruction:
>
> double[][] samples = new double[dim][nrs];
> .......
> set = new Gridded2DDoubleSet(xy, samples, size, size);
> nrs in my case would be 5 * 10 = 50
> dim would be 2
> I don't know what size should it be in this case....
>
> I only a total of 15 sample points (both x and y) so I don't know where I
> would
> go to find other sample points that are needed for
> VISAD. Any answer to this question is greatly appreciated.
The Gridded2DDoubleSet constructor call is:
Gridded2DDoubleSet(MathType type, double[][] samples,
int lengthX, int lengthY)
In your case lengthX = 5 and lengthY = 10. If your data are
evenly spaced in x and y, then you could use the Linear2DSet
constructor instead, called with:
Linear2DSet(MathType type, double first1, double last1, int length1,
double first2, double last2, int length2)
where length1 = 5 and the 5 X points are evenly spaced between
first1 and last1, and length2 = 10 and the 10 Y points are
evenly spaced between first2 and last2.
If your data are not evenly spaced, then you must use
Gridded2DSet (or Gridded2DDoubleSet if you need double
precision for X and Y values) and you'd fill the samples
array in the constructor like this:
int k = 0;
for (iy=0; iy<10; iy++) {
for (ix=0; ix<5; ix++) {
samples[0][k] = X value of point at (ix, iy)
samples[1][k] = Y value of point at (ix, iy)
k++;
}
}
Please let us know if this is not clear.
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