// Program that looks for a series of X-Y coordinates (0,0) for all points in a given frame // Once a sequence is found, the program removes that frame and the previous frame. // The program also removes the first two and last frames because those frames contain // erroneous data. The number of frames is updated in the point-light data file. // The new file will end with "_new1" #include #include #include void prompt(Str255); void inputFile(Str255); void errorFind(void); void outputFile(Str255 fileName); int contents[200][40]; int actFrames = 0; int actPoints = 0; int outContents[200][40]; int outFrames = 0; int main() { Str255 fileName = ""; int dummy; Str255 dumbc = ""; /* follow alg */ prompt(fileName); inputFile(fileName); errorFind(); outputFile(fileName); printf("\nEND\n"); printf("Press q to exit: "); if(dumbc[0] == 'q') { printf("exit"); } } void prompt(Str255 lFileName) { printf("Enter file name: "); scanf("%s", lFileName); } void inputFile(Str255 lFileName) { FILE * in = NULL; int i = 0; int j = 0; int temp = 0; in = fopen((const char *)lFileName, "r"); fscanf(in, "%d", &actPoints); fscanf(in, "%d", &actFrames); for (i = 0; i < actFrames; i++) { for (j = 0; j < actPoints * 2; j++) { fscanf(in, "%d", &temp); contents[i][j] = temp; } } fclose(in); } void errorFind() { const int errorFlag = 0; int numEFlags = actPoints * 2; int eFlagCount = 0; int cutMark[30]; int numCuts = 0; int i = 0; int j = 0; int k = 0; int end = 0; int old_i = 0; FILE * out = NULL; for(i = 0; i < actFrames; i++) { //eFlagCount = 0; for(j = 0; j < actPoints * 2; j++) { if((contents[i][j] == errorFlag) && (i != 0) && (i != (actFrames-1))) { eFlagCount++; if(eFlagCount == numEFlags) { cutMark[numCuts] = i - 1; numCuts++; eFlagCount = 0; } } else { eFlagCount = 0; } } } printf("Num points: %d\n", actPoints*2); printf("Number of Cuts: %d\n", numCuts); for(i=0;i