Gwyscan Library
 All Files Functions Enumerations Enumerator Modules
create_path_octave_2d.c

Example showing how to create a two-dimensional octave scan. Octave scan is used to get optimum information for roughness spectral properties evaluation.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "lib/gwyscan.h"
int
main(void)
{
int i, order = 4, noctaves = 3;
double xreal = 1e-6, yreal = 1e-6;
/* Create a two-dimensional octave scan. */
int ndata = gwyscan_create_path_octave_2d(NULL, order, noctaves,
xreal, yreal, 0.0, 0.0);
double *xydata = malloc(2*ndata*sizeof(double));
gwyscan_create_path_octave_2d(xydata, order, noctaves,
xreal, yreal, 0.0, 0.0);
FILE *fp = fopen("scan_path.txt", "wt");
if (fp == NULL)
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;
}