Gwyscan Library
 All Files Functions Enumerations Enumerator Modules
modify_path_flip_horizontal.c

Example showing how to flip points in existing path horizontally.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include "lib/gwyscan.h"
int main()
{
int i;
int ndata;
double *xydata, *xydata_fh;
/*********************************** path generation **********************************/
// LabView friendly implementation
xydata = malloc(2*ndata * sizeof(double));
xydata_fh = malloc(2*ndata * sizeof(double));
gwyscan_modify_path_flip_horizontal(xydata_fh, xydata, ndata);
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);
fp = fopen("scan_path_flip_horizontal.txt", "wt");
if (fp == NULL)
return 0;
for (i = 0; i < ndata; i++)
fprintf(fp, "%d %g %g\n", i, xydata_fh[2*i], xydata_fh[2*i + 1]);
fclose(fp);
free(xydata);
free(xydata_fh);
return 0;
}