-------------------------------------------------- err2csv.c -------------------------------------------------- /** ** err2csv - convert error xyz and rgb + error to antz csv ** ** CREATED: 2014.03.21 ABS copied from xyz2csv ** MODIFIED: 2014.03.24 ABS added features ** MODIFIED: 2014.03.26 ABS added threshold ** ** **/ #include "err2csv.h" #include "synglyphx.h" main(argc, argv) int argc; char** argv; { /* declare functions */ void read_glyph(); int write_glyph(); /* declare local variables */ int id, row; int i, g, old_id, v; float lat_min, lat_max, lon_min, lon_max; float lat_denom, lon_denom; int delta_r, delta_g, delta_b; int brightness; int temp_red, temp_grn, temp_blu; FILE *t_fp; char temp_tags_string[MAX_LINE]; /* initialize global variables (including parameters) */ defaultParms(); parseArgs(argc, argv); if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: Debug = %d\n", argv[0], Debug); fprintf(stderr, "%s: DEBUG: NumLines = %d\n", argv[0], NumLines); fprintf(stderr, "%s: DEBUG: GlyphFile = %s\n", argv[0], GlyphFile); fprintf(stderr, "%s: DEBUG: NumGlyphLines = %d\n", argv[0], NumGlyphLines); fprintf(stderr, "%s: DEBUG: AveColors = %d\n", argv[0], AveColors); fprintf(stderr, "%s: DEBUG: ColorErrs = %d\n", argv[0], ColorErrs); fprintf(stderr, "%s: DEBUG: Decimate = %d\n", argv[0], Decimate); fprintf(stderr, "%s: DEBUG: Floor = %d\n", argv[0], Floor); fprintf(stderr, "%s: DEBUG: Height = %f\n", argv[0], Height); fprintf(stderr, "%s: DEBUG: BaseScale = %f\n", argv[0], BaseScale); fprintf(stderr, "%s: DEBUG: Scale = %f\n", argv[0], Scale); fprintf(stderr, "%s: DEBUG: Threshold = %f\n", argv[0], Threshold); fprintf(stderr, "%s: DEBUG: ZScale = %f\n", argv[0], ZScale); fprintf(stderr, "%s: DEBUG: SW_lat = %.7f\n", argv[0], SW_lat); fprintf(stderr, "%s: DEBUG: SW_lon = %.7f\n", argv[0], SW_lon); fprintf(stderr, "%s: DEBUG: NE_lat = %.7f\n", argv[0], NE_lat); fprintf(stderr, "%s: DEBUG: NE_lon = %.7f\n", argv[0], NE_lon); } if (NumGlyphLines > MAX_GLYPH_ROWS) { fprintf(stderr, "%s: DEBUG: NumGlyphLines must be <= %d\n", argv[0], MAX_GLYPH_ROWS); } if (NumLines > MAX_ROWS) { fprintf(stderr, "%s: DEBUG: NumLines must be <= %d\n", argv[0], MAX_ROWS); } /* initialize local variables */ /* read */ t_fp = fopen(TagsFile, "w"); read_glyph(GlyphFile, NumGlyphLines); /* ok? */ if ( Glyph_array[PARENT_ID_4][FirstGoodLine] != 0.0) { fprintf(stderr, "%s: ERROR: Glyph_array[PARENT_ID_4][%d] = %f, should be 0.0\n", argv[0], FirstGoodLine, Glyph_array[PARENT_ID_4][FirstGoodLine]); exit(0); } /* read xyzRGBerr file */ for (row = 0; row < NumLines; row++) { fscanf(stdin, "%f,%f,%f,%d,%d,%d,%f,%f", &Lat[row], &Lon[row], &Zs[row], &Red[row], &Grn[row], &Blu[row], &CE90[row], &LE90[row]); sprintf(&Tags[row][0], "row:%d err CE90:%.1f LE90:%.1f TOT:%.1f", row, CE90[row], LE90[row], CE90[row] + LE90[row]); if (AveColors) { brightness = (Red[row] + Grn[row] + Blu[row])/3; Red[row] = Grn[row] = Blu[row] = brightness; } if (Floor) { brightness = Floor; Red[row] = Grn[row] = Blu[row] = brightness; } if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: Lat[%d] = %f\n", argv[0], row, Lat[row]); fprintf(stderr, "%s: DEBUG: Lon[%d] = %f\n", argv[0], row, Lon[row]); fprintf(stderr, "%s: DEBUG: Zs[%d] = %f\n", argv[0], row, Zs[row]); fprintf(stderr, "%s: DEBUG: Red[%d] = %d\n", argv[0], row, Red[row]); fprintf(stderr, "%s: DEBUG: Grn[%d] = %d\n", argv[0], row, Grn[row]); fprintf(stderr, "%s: DEBUG: Blu[%d] = %d\n", argv[0], row, Blu[row]); fprintf(stderr, "%s: DEBUG: CE90[%d] = %f\n", argv[0], row, CE90[row]); fprintf(stderr, "%s: DEBUG: LE90[%d] = %f\n", argv[0], row, LE90[row]); fprintf(stderr, "%s: DEBUG: Tags[%d] = %s\n", argv[0], row, &Tags[row][0]); } if (row == 0) { lat_max = Lat[row]; lat_min = Lat[row]; lon_max = Lon[row]; lon_min = Lon[row]; } if (row > 0 && Lat[row] > lat_max) { lat_max = Lat[row]; } if (row > 0 && Lat[row] < lat_min) { lat_min = Lat[row]; } if (row > 0 && Lon[row] > lon_max) { lon_max = Lon[row]; } if (row > 0 && Lon[row] < lon_min) { lon_min = Lon[row]; } if (SW_lat != NE_lat && SW_lon != NE_lon) { /* convert Lat/Lon to map coordinates */ lat_denom = NE_lat - SW_lat; lon_denom = NE_lon - SW_lon; NewLat[row] = 180.0*(Lat[row] - SW_lat)/lat_denom - 90.0; NewLon[row] = 360.0*(Lon[row] - SW_lon)/lon_denom - 180.0; } else { NewLat[row] = Lat[row]; NewLon[row] = Lon[row]; } if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: NewLat[row] = %f\n", argv[0], NewLat[row]); fprintf(stderr, "%s: DEBUG: NewLon[row] = %f\n", argv[0], NewLon[row]); fprintf(stderr, "%s: DEBUG: lat_denom = %f\n", argv[0], lat_denom); fprintf(stderr, "%s: DEBUG: lon_denom = %f\n", argv[0], lon_denom); } } /* end for row */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: lat_min = %f\n", argv[0], lat_min); fprintf(stderr, "%s: DEBUG: lat_max = %f\n", argv[0], lat_max); fprintf(stderr, "%s: DEBUG: lon_min = %f\n", argv[0], lon_min); fprintf(stderr, "%s: DEBUG: lon_max = %f\n", argv[0], lon_max); } /* process & write */ fprintf(t_fp, "id,record_id,table_id,title,description\n"); i = 0; id = 300; /* * error data: CE90 min: 2.30 max: 2.90 LE90: min: 2.20 max: 3.20 */ for (row = 0; row < NumLines; row++) { if ((!Decimate || drand48()*(float)Decimate <= 1.0) && CE90[row] + LE90[row] >= Threshold) { /* call me superstitious */ if (CE90[row] < 0.0) { CE90[row] = 0.0; } if (CE90[row] > 10.0) { CE90[row] = 10.0; } if (LE90[row] < 0.0) { LE90[row] = 0.0; } if (LE90[row] > 10.0) { LE90[row] = 10.0; } Glyph_array[SELECTED_3][FirstGoodLine] = 0.0; Glyph_array[SELECTED_3][FirstGoodLine + 1] = 0.0; /* KLUDGE */ Glyph_array[SCALE_X_25][FirstGoodLine] = Scale*(CE90[row] + BaseScale); Glyph_array[SCALE_Y_26][FirstGoodLine] = Scale*(CE90[row] + BaseScale); Glyph_array[SCALE_Z_27][FirstGoodLine] = Scale*(LE90[row] + BaseScale); Glyph_array[TRANSLATE_X_28][FirstGoodLine] = NewLon[row]; Glyph_array[TRANSLATE_Y_29][FirstGoodLine] = NewLat[row]; Glyph_array[TRANSLATE_Z_30][FirstGoodLine] = Height + Zs[row]*ZScale; if (ColorErrs) { delta_r = 255 - Red[row]; delta_g = 255 - Grn[row]; delta_b = 255 - Blu[row]; temp_red = Red[row] + (int)((CE90[row] + BaseScale)*(float)delta_r); temp_grn = Grn[row] + (int)((LE90[row] + BaseScale)*(float)delta_g); temp_blu = 0; /* EXPERIMENTAL KLUDGE */ Glyph_array[COLOR_R_55][FirstGoodLine] = temp_red; Glyph_array[COLOR_G_56][FirstGoodLine] = temp_grn; Glyph_array[COLOR_B_57][FirstGoodLine] = temp_blu; } else { Glyph_array[COLOR_R_55][FirstGoodLine] = Red[row]; Glyph_array[COLOR_G_56][FirstGoodLine] = Grn[row]; Glyph_array[COLOR_B_57][FirstGoodLine] = Blu[row]; } old_id = id; id = write_glyph(NumGlyphLines, id); /* write tags */ v = 0; for (g = old_id; g < id; g++) { if (v == 0) { fprintf(t_fp, "%d,%d,0,\"%s\",\"unused\"\n", i++, g, Tags[row]); } else { fprintf(t_fp, "%d,%d,0,\"%s - var %d\",\"unused\"\n", i++, g, Tags[row], v++); } } } } #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: id = %d\n", argv[0], id); } #endif } /* end main */ /* * defaultParms - initialize global variables */ defaultParms() { Debug = FALSE; NumLines = 1; NumGlyphLines = 1; Decimate = 0; ColorErrs = FALSE; AveColors = FALSE; Floor = 0; Height = 0.0; Scale = 1.0; Threshold = 0.0; BaseScale = 1.0; ZScale = 1.0; SW_lat = SW_lon = NE_lat = NE_lon = 0.0; strcpy(GlyphFile, "glyph_in.csv"); strcpy(TagsFile, "ANTzTag0001.csv"); } /* end defaultParms() */ /* * parseArgs - parse arguments into global variables */ parseArgs(argc, argv) int argc; char** argv; { int i; for (i = 0; i < argc; i++) { if (argv[i][0] == '-') { switch (argv[i][1]) { case 'D' : Debug = TRUE; break; case 'A' : AveColors = TRUE; break; case 'b' : BaseScale = atof(&argv[++i][0]); break; case 'C' : ColorErrs = TRUE; break; case 'c' : SW_lat = atof(&argv[++i][0]); SW_lon = atof(&argv[++i][0]); NE_lat = atof(&argv[++i][0]); NE_lon = atof(&argv[++i][0]); break; case 'd' : Decimate = atoi(&argv[++i][0]); break; case 'f' : Floor = atoi(&argv[++i][0]); break; case 'g' : NumGlyphLines = atoi(&argv[++i][0]); break; case 'G' : strcpy(GlyphFile, &argv[++i][0]); break; case 'H' : Height = atof(&argv[++i][0]); break; case 'h' : help(argv); exit(0); break; case 'n' : NumLines = atoi(&argv[++i][0]); break; case 's' : Scale = atof(&argv[++i][0]); break; case 't' : Threshold = atof(&argv[++i][0]); break; case 'T' : strcpy(TagsFile, &argv[++i][0]); break; case 'u' : usage(argv); exit(0); break; case 'z' : ZScale = atof(&argv[++i][0]); break; default: fprintf(stderr, "%s: ERROR: illegal flag: %s\n", argv[0], argv[i]); exit(0); break; } /* end switch */ } /* end if */ } /* end for(i) */ } /* end parseArgs() */ /* * getl - modified from Kernighan & Ritchie to take stream */ int getl(stream, s, lim) /* get line into s, return length */ FILE *stream; char s[]; int lim; { int c, i; i = 0; while (--lim > 0 && (c = getc(stream)) != EOF && c != '\n') s[i++] = c; if (c == '\n') s[i++] = c; s[i] = EOS; return(i); } /* end getl() */ -------------------------------------------------- err2csv.h -------------------------------------------------- /* * err2csv.h -- include file for err2csv.c */ /* includes */ #include #include #include #include #include #include /* constants */ #define TRUE (1) #define FALSE (0) #define MAX_LINE (255) #define MAX_GLYPH_LINE (4096) #define NUM_COLUMNS (94) #define MAX_CODE (5) #define MAX_NODE_NUM (500) #define EOS (0) #define STRING_EQUAL (0) #define MAX_ROWS (2400000) #define MAX_GLYPH_ROWS (400) #define ERROR_CODE (-1) #define NO_MATCH (-1) #define UNIVERSAL_PARENT (0) #define START_ID (33) #define CIRCLE_DEG (360.0) /* global variables */ float Lat[MAX_ROWS]; /* latitude (NS) */ float Lon[MAX_ROWS]; /* longitude (EW) */ float Zs[MAX_ROWS]; /* altitude */ float NewLat[MAX_ROWS]; /* adjusted latitude (NS) */ float NewLon[MAX_ROWS]; /* adjusted longitude (EW) */ int Red[MAX_ROWS]; /* */ int Grn[MAX_ROWS]; /* */ int Blu[MAX_ROWS]; /* */ double NE_lat; /* NE map corner lat */ double NE_lon; /* NE map corner lon */ double SW_lat; /* SW map corner lat */ double SW_lon; /* SW map corner lon */ float CE90[MAX_ROWS]; /* */ float LE90[MAX_ROWS]; /* */ char Tags[MAX_ROWS][MAX_LINE]; /* tags */ /* flag-settable parameters (global variables) */ int Debug; /* Boolean: TRUE = debug writes */ int AveColors; /* Boolean */ int ColorErrs; /* Boolean */ int Decimate; /* */ int Floor; float Height; /* */ float Scale; /* */ float Threshold; /* */ float BaseScale; float ZScale; /* */ int NumLines; /* */ int NumGlyphLines; /* */ char GlyphFile[MAX_LINE]; /* glyph file name */ char TagsFile[MAX_LINE]; /* tags file name */ /* macros */ -------------------------------------------------- glyph_tools.c -------------------------------------------------- /** ** glyph_tools: contains: ** ** read_glyph() ** write_glyph() **/ #include "err2csv.h" #include "synglyphx.h" /* * read_glyph - read from a CSV file into Glyph_array[][] */ void read_glyph(filename, num_lines) char * filename; int num_lines; { /* declare local variables */ int len, col, i_col, d_col, line_num; char temp_char; char input_line[MAX_GLYPH_LINE]; char data_array[MAX_GLYPH_LINE]; FILE* g_fp; /* init local variables */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: num_lines = %d\n", "read_glyph()", num_lines); } FirstGoodLine = 0; /* read */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #0 about to fopen() file: %s\n", "read_glyph()", GlyphFile); } g_fp = fopen(GlyphFile, "r"); if (g_fp == NULL) { fprintf(stderr, "%s: ERROR: fopen failed, error: %s\n", "read_glyph()", strerror(errno)); exit(0); } if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #1 g_fp = %d\n", "read_glyph()", g_fp); } len = getl(g_fp, &input_line, MAX_GLYPH_LINE); /* text header */ if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: #2 header length = %d\n", "read_glyph()", len); fprintf(stderr, "%s: DEBUG: #2 header input_line = >%s<\n", "read_glyph()", input_line); fprintf(stderr, "%s: DEBUG: #2 header input_line[0] = %d ASCII\n", "read_glyph()", (int)input_line[0]); } for (line_num = 1; line_num < num_lines; line_num++) { len = getl(g_fp, &input_line, MAX_GLYPH_LINE); #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: input_line number %d: >%s<\n", "read_glyph()", line_num, input_line); } #endif if (len == 0) { fprintf(stderr, "%s: ERROR: zero length line number %d\n", "read_glyph()", line_num); break; } i_col = 0; for (col = 0; col < NUM_COLUMNS - 1; col++) { d_col = 0; temp_char = input_line[i_col]; while (temp_char != ',') { temp_char = input_line[i_col++]; data_array[d_col++] = temp_char; } data_array[d_col - 1] = EOS; sscanf(data_array, "%f", &Glyph_array[col][line_num]); #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: data_array = >%s<\n", "read_glyph()", data_array); fprintf(stderr, "%s: DEBUG: Glyph_array[%d][%d] = %f\n", "read_glyph()", col, line_num, Glyph_array[col][line_num]); } #endif } d_col = 0; temp_char = input_line[i_col]; while (temp_char != ',') { temp_char = input_line[i_col++]; data_array[d_col++] = temp_char; } data_array[d_col - 1] = EOS; sscanf(data_array, "%f", &Glyph_array[NUM_COLUMNS - 1][line_num]); if ((!FirstGoodLine) && (Glyph_array[1][line_num] == 5.0)) { FirstGoodLine = line_num; #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: FirstGoodLine = %d\n", "read_glyph()", FirstGoodLine); } #endif } if (Glyph_array[NUM_COLUMNS - 1][line_num] != 420.0) { fprintf(stderr, "%s: ERROR: record %d was: %f, should be 420.0\n", NUM_COLUMNS - 1, "read_glyph()", Glyph_array[NUM_COLUMNS - 1][line_num]); exit(0); } } fclose(g_fp); } /* * write_glyph - write from Glyph_array[][] into a CSV file */ int write_glyph(num_lines, start_id) int num_lines; int start_id; { int col, row, temp_int; #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: num_lines = %d\n", "write_glyph()", num_lines); fprintf(stderr, "%s: DEBUG: start_id = %d\n", "write_glyph()", start_id); } #endif for (row = FirstGoodLine; row < num_lines; row++) { if (FirstGoodLine == row) { First_id = Glyph_array[ID_0][row]; #ifdef SUPER_DEBUG if (Debug != FALSE) { fprintf(stderr, "%s: DEBUG: First_id = %d\n", "write_glyph()", First_id); } #endif } /* do all surgery here */ Glyph_array[ID_0][row] = Glyph_array[ID_0][row] - First_id + start_id; Glyph_array[DATA_2][row] = Glyph_array[ID_0][row]; /* anything with parent zero stays that way */ if (Glyph_array[PARENT_ID_4][row] != 0.0) { Glyph_array[PARENT_ID_4][row] = Glyph_array[PARENT_ID_4][row] - First_id + start_id; } Glyph_array[RECORD_ID_92][row] = Glyph_array[ID_0][row]; /* end of surgery */ for (col = 0; col < NUM_COLUMNS; col++) { temp_int = (int)Glyph_array[col][row]; if ((float)temp_int == Glyph_array[col][row]) { fprintf(stdout, "%d", (int)Glyph_array[col][row]); } else { fprintf(stdout, "%f", Glyph_array[col][row]); } if (col < NUM_COLUMNS - 1) { fprintf(stdout, ","); } } fprintf(stdout, "\n"); } return start_id + num_lines - FirstGoodLine; } -------------------------------------------------- help.c -------------------------------------------------- /* * help - give program help */ #include help(argv) char** argv; { fprintf(stderr, "%s: HELP:\n", argv[0]); fprintf(stderr, "\n"); fprintf(stderr, " xyz2csv - convert lon/lat, elevation, optional\n"); fprintf(stderr, " colors and tags to ANTz csv files\n"); fprintf(stderr, "\n"); } /* end of help */ -------------------------------------------------- usage.c -------------------------------------------------- /* * usage - give program usage */ #include usage(argv) char** argv; { fprintf(stderr, "%s: USAGE: %s [flags] > outfile\n", argv[0], argv[0]); fprintf(stderr, "\n"); fprintf(stderr, " flag meaning default \n"); fprintf(stderr, " ------------- ---------------------- ----------\n"); fprintf(stderr, " -D debug FALSE \n"); fprintf(stderr, " -c # # # # map lat/lon corners 0 0 0 0 \n"); fprintf(stderr, " as floats - NW & SE \n"); fprintf(stderr, " (0.0s = ignore) \n"); fprintf(stderr, " -d decimate amount (1/d) 0.0 \n"); fprintf(stderr, " 0.0 = ignore \n"); fprintf(stderr, " -G glyph file name glyph_in.csv\n"); fprintf(stderr, " -g number of glyph lines 1 \n"); fprintf(stderr, " -H height to add 0.0 \n"); fprintf(stderr, " -h help on this program \n"); fprintf(stderr, " -n number of input lines 1 \n"); fprintf(stderr, " -T tags file name ANTzTag0001.csv\n"); fprintf(stderr, " -u usage (this message) \n"); fprintf(stderr, " -z z scale 1.0 \n"); fprintf(stderr, "\n"); } /* end of usage */ -------------------------------------------------- synglyphx.h -------------------------------------------------- #define ANTZ_TYPE_PIN (5) #define ANTZ_TYPE_LINK (7) #define ANTZ_GEOM_CUBE_WIRE (0) #define ANTZ_GEOM_CUBE (1) #define ANTZ_GEOM_SPHERE_WIRE (2) #define ANTZ_GEOM_SPHERE (3) #define ANTZ_GEOM_CONE_WIRE (4) #define ANTZ_GEOM_CONE (5) #define ANTZ_GEOM_TOROID (7) #define ANTZ_GEOM_DODEC_WIRE (8) #define ANTZ_GEOM_DODEC (9) #define ANTZ_GEOM_OCTO_WIRE (10) #define ANTZ_GEOM_OCTO (11) #define ANTZ_GEOM_TETRA_WIRE (12) #define ANTZ_GEOM_TETRA (13) #define ANTZ_GEOM_ICOS_WIRE (14) #define ANTZ_GEOM_ICOS (15) #define ANTZ_GEOM_PIN (16) #define ANTZ_GEOM_PIN_WIRE (17) #define ANTZ_GEOM_CYLINDER_WIRE (18) #define ANTZ_GEOM_CYLINDER (19) #define ANTZ_TOPO_LINK (0) #define ANTZ_TOPO_CUBE (1) #define ANTZ_TOPO_SPHERE (2) #define ANTZ_TOPO_TORUS (3) #define ANTZ_TOPO_CYLINDER (4) #define ANTZ_TOPO_PIN (5) #define ANTZ_TOPO_ROD (6) #define ANTZ_TOPO_POINT (7) #define ID_0 (0) #define TYPE_1 (1) #define DATA_2 (2) #define SELECTED_3 (3) #define PARENT_ID_4 (4) #define BRANCH_LEVEL_5 (5) #define CHILD_ID_6 (6) #define CHILD_INDEX_7 (7) #define CHILD_COUNT_8 (8) #define CH_INPUT_ID_9 (9) #define CH_OUTPUT_ID_10 (10) #define CH_LAST_UPDATED_11 (11) #define AVERAGE_12 (12) #define SAMPLE_13 (13) #define AUX_A_X_14 (14) #define AUX_A_Y_15 (15) #define AUX_A_Z_16 (16) #define AUX_B_X_17 (17) #define AUX_B_Y_18 (18) #define AUX_B_Z_19 (19) #define COLOR_SHIFT_20 (20) #define ROTATE_VEC_X_21 (21) #define ROTATE_VEC_Y_22 (22) #define ROTATE_VEC_Z_23 (23) #define ROTATE_VEC_S_24 (24) #define SCALE_X_25 (25) #define SCALE_Y_26 (26) #define SCALE_Z_27 (27) #define TRANSLATE_X_28 (28) #define TRANSLATE_Y_29 (29) #define TRANSLATE_Z_30 (30) #define TAG_OFFSET_X_31 (31) #define TAG_OFFSET_Y_32 (32) #define TAG_OFFSET_Z_33 (33) #define ROTATE_RATE_X_34 (34) #define ROTATE_RATE_Y_35 (35) #define ROTATE_RATE_Z_36 (36) #define ROTATE_X_37 (37) #define ROTATE_Y_38 (38) #define ROTATE_Z_39 (39) #define SCALE_RATE_X_40 (40) #define SCALE_RATE_Y_41 (41) #define SCALE_RATE_Z_42 (42) #define TRANSLATE_RATE_X_43 (43) #define TRANSLATE_RATE_X_44 (44) #define TRANSLATE_RATE_X_45 (45) #define TRANSLATE_VEC_X_46 (46) #define TRANSLATE_VEC_X_47 (47) #define TRANSLATE_VEC_X_48 (48) #define SHADER_49 (49) #define GEOMETRY_50 (50) #define LINE_WIDTH_51 (51) #define POINT_SIZE_52 (52) #define RATIO_53 (53) #define COLOR_INDEX_54 (54) #define COLOR_R_55 (55) #define COLOR_G_56 (56) #define COLOR_B_57 (57) #define COLOR_A_58 (58) #define COLOR_FADE_59 (59) #define TEXTURE_ID_60 (60) #define HIDE_61 (61) #define FREEZE_62 (62) #define TOPO_63 (63) /* facet auto_zoom_x auto_zoom_y auto_zoom_z trigger_hi_x trigger_hi_y trigger_hi_z trigger_lo_x trigger_lo_y trigger_lo_z set_hi_x set_hi_y set_hi_z set_lo_x set_lo_y set_lo_z proximity_x proximity_y proximity_z proximity_mode_x proximity_mode_y proximity_mode_z */ #define SEGMENTS_X_86 (86) #define SEGMENTS_Y_87 (87) #define SEGMENTS_Z_88 (88) #define TAG_MODE_89 (89) #define FORMAT_ID_90 (90) #define TABLE_ID_91 (91) #define RECORD_ID_92 (92) #define SIZE_93 (93) /* gloabl vars used by glyph_tools */ int FirstGoodLine; int First_id; float Glyph_array[NUM_COLUMNS][MAX_GLYPH_ROWS]; -------------------------------------------------- Makefile -------------------------------------------------- O_FILES = err2csv.o glyph_tools.o usage.o help.o CFLAGS = -lc -g -lm CC = gcc err2csv: $(O_FILES) $(CC) $(CFLAGS) -o err2csv.exe $(O_FILES) -------------------------------------------------- Test -------------------------------------------------- # d=/cygdrive/c/Users/Alan/Antz2014/antz_msw_2013-11-21/usr/csv # echo '------------------------------------------------------------------------------' # ~/swdev/C/err2csv/err2csv.exe -D -t 5.0 -b -2.1 -s 0.36 -c 33.905266155474649 -118.39714482432021 33.907727245282345 -118.38229948451819 -H 10.0 -n `wc -l err_data.txt` -g `wc -l cube.csv` -G cube.csv < err_data.txt > body_e.csv cat head.csv body_e.csv > Test_err.csv cp Test_err.csv $d cp Test_err.csv ANTz0001.csv cp ANTz0001.csv $d cp ANTzTag0001.csv $d cp cube.csv $d -------------------------------------------------- err_data.txt -------------------------------------------------- 33.905266191352261,-118.39002587133582,-0.15,255,0,0,2.59,3.02 33.905266169532474,-118.39001981434653,-0.18,0,255,0,2.47,2.45 33.905266239096782,-118.39001365068654,-0.23,0,0,255,2.54,2.34 33.905266218496806,-118.39000748556286,-0.11,255,255,0,2.34,2.58 33.905266196676116,-118.39000142857356,-0.04,0,255,255,2.88,3.08 -------------------------------------------------- cube.csv -------------------------------------------------- id,type,data,selected,parent_id,branch_level,child_id,child_index,child_count,ch_input_id,ch_output_id,ch_last_updated,average,sample,aux_a_x,aux_a_y,aux_a_z,aux_b_x,aux_b_y,aux_b_z,color_shift,rotate_vec_x,rotate_vec_y,rotate_vec_z,rotate_vec_s,scale_x,scale_y,scale_z,translate_x,translate_y,translate_z,tag_offset_x,tag_offset_y,tag_offset_z,rotate_rate_x,rotate_rate_y,rotate_rate_z,rotate_x,rotate_y,rotate_z,scale_rate_x,scale_rate_y,scale_rate_z,translate_rate_x,translate_rate_y,translate_rate_z,translate_vec_x,translate_vec_y,translate_vec_z,shader,geometry,line_width,point_size,ratio,color_index,color_r,color_g,color_b,color_a,color_fade,texture_id,hide,freeze,topo,facet,auto_zoom_x,auto_zoom_y,auto_zoom_z,trigger_hi_x,trigger_hi_y,trigger_hi_z,trigger_lo_x,trigger_lo_y,trigger_lo_z,set_hi_x,set_hi_y,set_hi_z,set_lo_x,set_lo_y,set_lo_z,proximity_x,proximity_y,proximity_z,proximity_mode_x,proximity_mode_y,proximity_mode_z,segments_x,segments_y,segments_z,tag_mode,format_id,table_id,record_id,size 1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 2,1,2,0,0,0,0,2,3,0,0,0,0,1,0,0,0,0,0,0,0.000000,0.000000,0.482963,0.836516,-0.258819,1.000000,1.000000,1.000000,-17.778023,-30.792437,9.527214,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,75.000000,30.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,36.810326,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 3,1,3,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,-1.000000,1.000000,1.000000,1.000000,-0.500000,0.000000,571.750000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 4,1,4,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,0.000000,0.000000,1.000000,-0.000000,1.000000,1.000000,1.000000,0.000000,-90.000000,7.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,90.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 5,1,5,0,2,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,0.000000,-1.000000,-0.000000,-0.000000,1.000000,1.000000,1.000000,85.000000,0.000000,7.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,90.000000,270.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,-0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 6,6,6,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,1.000000,0.000000,0.100000,3,0,0,255,150,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,12,6,0,0,0,0,0,420 32,5,32,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0.000000,1.000000,0.000000,0.000000,0.000000,1.000000,1.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,1,1.000000,0.000000,0.100000,0,50,101,101,255,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0,0,0,16,16,0,0,0,0,0,420 --------------------------------------------------