Gwyscan Library
 All Data Structures Files Functions Enumerations Enumerator Macros Groups
create_path_space_filling.c

Example showing how to create space filling curve based path. Benefit of this approach is that results do not have anisotropy in statistical properties (fast and slow axis).

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "lib/gwyscan.h"
int
main(void)
{
int i, order = 4;
double xreal = 1e-6, yreal = 1e-6;
/* Create simple space-filling curve of order 4, i.e. filling completely
* a 16x16 grid. */
int ndata = gwyscan_create_path_space_filling(NULL, order,
xreal, yreal, 0.0, 0.0);
double *xydata = malloc(2*ndata*sizeof(double));
xreal, yreal, 0.0, 0.0);
FILE *fp = fopen("scan_path_space_filling.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;
}