|
|
1.1 ! root 1: # include "stdio.h" ! 2: # include "math.h" ! 3: # include "assert.h" ! 4: # define radp 57.2957795 ! 5: main() ! 6: { ! 7: /* reads ascii patch file; converts to binary and does cosine conversion. */ ! 8: char line[100], *s, opat[10]; ! 9: long pos; ! 10: float a[4]; ! 11: double correct; ! 12: opat[0]=0; ! 13: pos=0; ! 14: correct = cos(40.0/radp); ! 15: while (gets(line)) ! 16: { ! 17: if (strncmp(opat, line, 5)) ! 18: fprintf(stderr, "%.5s %ld\n", line, pos); ! 19: strncpy(opat, line, 5); ! 20: for(s=line; *s && *s!='\t'; s++) ! 21: ; ! 22: sscanf(s, "%f %f %f %f", a+0, a+1, a+2, a+3); ! 23: /* need to multiply longitudes by cosine of latitude */ ! 24: a[1] *= correct; ! 25: a[3] *= correct; ! 26: write (1, a, 4*sizeof(float)); ! 27: pos+= 4*sizeof(float); ! 28: } ! 29: fprintf(stderr, "ENDED %ld\n", pos); ! 30: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.