#include "stdio.h" #include "stdlib.h" #include "math.h" #include "paulslib.h" #include "bitmaplib.h" /* Calculate continuous tone recurrence plots */ int CalcRecurrence(double *,int,int,int,char *); #define N 400 double *data; int npoints = 0; int main(int argc,char **argv) { int i; int delay,dimension; int dimstart=2,dimstop=10,dimstep=1; int delstart=1,delstop=5,delstep=1; double x,sum=0,sum2=0,mean,std; char basename[100]; FILE *fptr; /* Check there are enough arguments */ if (argc < 2) { fprintf(stderr,"Usage: %s datafilename\n",argv[0]); fprintf(stderr," [-dim1 %d] [-dim2 %d] [-dim3 %d]\n", dimstart,dimstop,dimstep); fprintf(stderr," [-del1 %d] [-del2 %d] [-del3 %d]\n", delstart,delstop,delstep); fprintf(stderr,"\n"); exit(0); } /* Handle the arguments */ for (i=0;i= i+1) dimstart = atoi(argv[i+1]); if (strcmp(argv[i],"-dim2") == 0 && argc >= i+1) dimstop = atoi(argv[i+1]); if (strcmp(argv[i],"-dim3") == 0 && argc >= i+1) dimstep = atoi(argv[i+1]); if (strcmp(argv[i],"-del1") == 0 && argc >= i+1) delstart = atoi(argv[i+1]); if (strcmp(argv[i],"-del2") == 0 && argc >= i+1) delstop = atoi(argv[i+1]); if (strcmp(argv[i],"-del3") == 0 && argc >= i+1) delstep = atoi(argv[i+1]); } /* Form the basename */ strcpy(basename,argv[1]); for (i=0;i= n || indexj >= n) { fprintf(stderr,"Unexpectedly passed the end of the data\n"); return(FALSE); } delta = data[indexi] - data[indexj]; distance += delta * delta; } distance = sqrt(distance); /* Store the minimum distance between the two points */ buffer[x0][y0] = MIN(buffer[x0][y0],distance); buffer[x1][y1] = MIN(buffer[x1][y1],distance); } } /* Find the bounds */ for (j=0;j 1e31) continue; rmin = MIN(rmin,buffer[i][j]); rmax = MAX(rmax,buffer[i][j]); } } fprintf(stderr,"\tDistance range = %g -> %g\n",rmin,rmax); /* Open and write bitmaps */ sprintf(fname,"%s_%d_%d.ppm",base,dim,delay); if ((fptr = fopen(fname,"w")) == NULL) { fprintf(stderr,"Unable to open ppm file %s\n",fname); return(FALSE); } for (j=0;j