Example of space filling curve path with progressive refinement, to get a preview first and succesively refine the path.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int
main(void)
{
int i, order = 5, coarse_order = 3, skip_order = -1;
double xreal = 1e-6, yreal = 1e-6;
coarse_order, skip_order,
xreal, yreal, 0.0, 0.0);
double *xydata = malloc(2*ndata*sizeof(double));
coarse_order, skip_order,
xreal, yreal, 0.0, 0.0);
FILE *fp = fopen("scan_path_space_filling_progressive.txt", "wt");
if (fp == NULL) {
printf("Error. Unable to open file for writing %s \n", strerror(errno));
return 0;
}
for (i = 0; i < ndata; i++)
fprintf(fp, "%d %g %g\n", i, xydata[2*i], xydata[2*i + 1]);
fclose(fp);
free(xydata);
return 0;
}