|
From: <WH...@bf...> - 2004-08-10 12:51:24
|
hi list,
here is the not-working (but compiling) testprogramm of mine. the data are:
input: x,y position and z=value here 0 or 1
i do plpoin() to demonstrate the data are there.
then i copy from struct in the feld X,Y,Z just to have
access, not clever but i works.
the target data dX,dY are filed with 0..count
after tranlating my data in to gridded data
i try to display the stuff.
were did i get the concept wrong ?
walter
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include "plplot/plConfig.h"
#include "plplot/plplot.h"
struct station {
PLFLT x;
PLFLT y;
PLFLT z;
};
int count=20;
int main(int argc, char *argv[])
{
/* original data set */
struct station pnt[count];
PLFLT X[count];
PLFLT Y[count];
PLFLT Z[count];
/* display data set */
PLFLT dX[count];
PLFLT dY[count];
PLFLT **dZ;
int i,alg,xborder,yborder;;
(void) plParseOpts(&argc, argv, PL_PARSE_FULL);
for(i=0;i<count;i++) {
pnt[i].x= (PLFLT) (rand()%100); /* 0...99 */
pnt[i].y= (PLFLT) (rand()%100); /* 0...99 */
pnt[i].z= (PLFLT) (rand()& 1); /* 0,1 */
}
/* Initialize plplot */
plsdev ("xwin"); /* we use only X11 */
plinit();
for(i=0;i<count;i++) {
X[i]=pnt[i].x;
Y[i]=pnt[i].y;
Z[i]=pnt[i].z;
dX[i]=i;
dY[i]=i;
}
plAlloc2dGrid(&dZ, count, count); /* the output grided data */
alg=1;
xborder=10;
yborder=10;
pladv(0);
plvpor(0.1,0.9,0.1,0.9);
plwind(0-xborder, 100+xborder ,0-yborder, 100+yborder );
plpoin(count, X, Y, 5);
pladv(0);
pllab("", "", "titletest");
plgriddata(X,Y,Z,count,dX,count,dY,count,dZ,alg,GRID_CSA);
plot3d(dX,dY,dZ,count,count,DRAW_LINEXY,0);
pladv(0);
plend();
return 0;
}
|