uint8_t Motion_controller::multi_face_zooming(const std::vector<cv::Rect> &faces,const cv::Rect &face_region,const double &distance) { uint16_t move_z = DEFAULT_DIS; if(glo_waist_shot) { cv::Rect standard(faces[0].x,faces[0].y,IMG_EXP_FACE_WIDTH,IMG_EXP_FACE_HEIGHT); if(abs(faces[0].height - standard.height) > threshold_face_y) { this->img_exp_dis = runCAMShift(standard); return this->zoom_in_out_by_distance(this->img_exp_dis,distance); } else return EVAL_COMPLETE; } else { cv::Rect standard(faces[0].x,faces[0].y,IMG_EXP_FACE_WIDTH_FULL,IMG_EXP_FACE_HEIGHT_FULL); if(abs(faces[0].height - standard.height) > threshold_face_y) { this->img_exp_dis = runCAMShift(standard); return this->zoom_in_out_by_distance(this->img_exp_dis,distance); } else return EVAL_COMPLETE; } return EVAL_COMPLETE; }
bool GenericFontFamilySettings::updateStandard(const AtomicString& family, UScriptCode script) { if (family == standard()) return false; setGenericFontFamilyMap(m_standardFontFamilyMap, family, script); return true; }
const HeaderStrategy * HeaderStrategy::create( const QString & type ) { QString lowerType = type.lower(); if ( lowerType == "all" ) return all(); if ( lowerType == "rich" ) return HeaderStrategy::rich(); //if ( lowerType == "standard" ) return standard(); // not needed, see below if ( lowerType == "brief" ) return brief(); if ( lowerType == "custom" ) return custom(); // don't kdFatal here, b/c the strings are user-provided // (KConfig), so fail gracefully to the default: return standard(); }
int main (void) { standard (); stack_align (); gdb1253 (); gdb1718 (); gdb1338 (); jump_at_beginning (); return 0; }
int dec64_to_string( dec64_string_state state, dec64 number, dec64_string_char string[] ) { /* dec64_to_string converts a dec64 number into a string. The caller provides the memory in which to deposit the string. The string must have sufficient capacity to hold 32 characters. If NULL is passed in as the string, then no characters will be deposited, but a character count will be returned. dec64_to_string returns the number of characters actually deposited in the string (not including the trailing \0). If the number is nan, then it returns 0 indicating an empty string. In standard mode, the number will be formatted conventionally unless it would require more than 17 digits, which would be due to excessive trailing zeros or zeros immediately after the decimal point. In that case scientific notation will be used instead. */ if (state == NULL || state->valid != confirmed) { return 0; } state->length = 0; state->string = string; if (dec64_is_any_nan(number) != DEC64_TRUE) { if (dec64_is_zero(number) == DEC64_TRUE) { emit(state, '0'); } else { if (number != state->number) { state->number = number; digitize(state); } if (number < 0) { emit(state, '-'); } switch (state->mode) { case engineering_mode: engineering(state); break; case scientific_mode: scientific(state); break; case standard_mode: standard(state); break; } } } emit_end(state); state->string = NULL; return state->length; }
const HeaderStrategy * HeaderStrategy::create( Type type ) { switch ( type ) { case All: return all(); case Rich: return rich(); case Standard: return standard(); case Brief: return brief(); case Custom: return custom(); } kdFatal( 5006 ) << "HeaderStrategy::create(): Unknown header strategy ( type == " << (int)type << " ) requested!" << endl; return 0; // make compiler happy }
task main() { motor[lClaw] = -127; motor[rClaw] = -127; wait1Msec(300); motor[lClaw] = 0; motor[rClaw] = 0; wait1Msec(200); arm(127, 200); arm(0, 350); arm(-127, 100); arm(0, 350); standard(127, 127, 1500); standard(0, 0, 350); motor[lClaw] = 127; motor[rClaw] = 127; wait1Msec(750); motor[lClaw] = 0; motor[rClaw] = 0; wait1Msec(300); standard(-127, -70, 500); standard(0, 0, 200); standard(-127, 127, 345); standard(0, 0, 200); }
File::File( std::string name_, Mode mode_, FileProvider* provider_ ) : _name ( name_ ) , _isOpen ( false ) , _mode ( mode_ ) , _size ( 0 ) , _position ( 0 ) , _provider ( provider_ ? *provider_ : standard() ) , name ( _name ) , isOpen ( _isOpen ) , mode ( _mode ) , size ( _size ) , position ( _position ) { }
void IComponent::Show(uint32 time) { D3DXCOLOR standard(1.0f, 1.0f, 1.0f, 1.0f); D3DXCOLOR highlight(1.25f, 1.25f, 1.45f, 1.1f); if (GetColorMod() != standard) FadeTo(time, standard); else { FadeTo(time, highlight); sEngine.PulseTimer.AddTimer(time * 2, [=] (const Utils::STimerDispatchEvt&) { this->FadeTo(uint32(time * 1.5f), standard); return TIMER_STOP_EXECUTION; }); } }
void Strobe::event() { beatcounter++; n = 0; strobecounter++; speed = (uint) (((double) speed / 255) * 50); if (speed <= 5) { speed = 5; } switch (type) { case 0: tripleShot(); break; case 1: standard(); break; case 2: switched(); break; case 3: switchedBLUEWHITE(); break; case 4: circle(); break; case 5: every4(); break; case 6: every8(); break; case 7: upanddown(); break; case 8: upperhalf(); break; case 9: lowerhalf(); break; case 10: random(); break; } }
value type_standard(value f) { if (!f->L) return 0; { value name = arg(f->R); if (name->T == type_str) { value def = standard(name); if (def) f = A(hold(Qlater),def); else f = hold(Qvoid); } else f = hold(Qvoid); drop(name); return f; } }
/**************** * The filter is used to make canonical text: Lines are terminated by * CR, LF, trailing white spaces are removed. */ int text_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) { size_t size = *ret_len; text_filter_context_t *tfx = opaque; int rc=0; if( control == IOBUFCTRL_UNDERFLOW ) { rc = standard( tfx, a, buf, size, ret_len ); } else if( control == IOBUFCTRL_FREE ) { if( tfx->truncated ) log_error(_("can't handle text lines longer than %d characters\n"), MAX_LINELEN ); xfree( tfx->buffer ); tfx->buffer = NULL; } else if( control == IOBUFCTRL_DESC ) mem2str (buf, "text_filter", *ret_len); return rc; }
void ir_call_transformer::map(const s_ptr<const ir_stmt_label> x) { standard(x); }
EmailEditDialog::EmailEditDialog( const QStringList &list, QWidget *parent ) : KDialog( parent ) { setCaption( i18n( "Edit Email Addresses" ) ); setButtons( KDialog::Ok | KDialog::Cancel ); setDefaultButton( KDialog::Cancel ); QWidget *page = new QWidget( this ); setMainWidget( page ); QGridLayout *topLayout = new QGridLayout( page ); topLayout->setSpacing( spacingHint() ); topLayout->setMargin( 0 ); mEmailListBox = new KListWidget( page ); mEmailListBox->setSelectionMode( QAbstractItemView::SingleSelection ); // Make sure there is room for the scrollbar mEmailListBox->setMinimumHeight( mEmailListBox->sizeHint().height() + 30 ); connect( mEmailListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(selectionChanged()) ); connect( mEmailListBox, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(edit()) ); topLayout->addWidget( mEmailListBox, 0, 0, 5, 2 ); mAddButton = new QPushButton( i18n( "Add..." ), page ); connect( mAddButton, SIGNAL(clicked()), SLOT(add()) ); topLayout->addWidget( mAddButton, 0, 2 ); mEditButton = new QPushButton( i18n( "Edit..." ), page ); mEditButton->setEnabled( false ); connect( mEditButton, SIGNAL(clicked()), SLOT(edit()) ); topLayout->addWidget( mEditButton, 1, 2 ); mRemoveButton = new QPushButton( i18n( "Remove" ), page ); mRemoveButton->setEnabled( false ); connect( mRemoveButton, SIGNAL(clicked()), SLOT(remove()) ); topLayout->addWidget( mRemoveButton, 2, 2 ); mStandardButton = new QPushButton( i18n( "Set as Standard" ), page ); mStandardButton->setEnabled( false ); connect( mStandardButton, SIGNAL(clicked()), SLOT(standard()) ); topLayout->addWidget( mStandardButton, 3, 2 ); topLayout->setRowStretch( 4, 1 ); QStringList items = list; if ( items.removeAll( QLatin1String( "" ) ) > 0 ) { mChanged = true; } else { mChanged = false; } QStringList::ConstIterator it; bool preferred = true; for ( it = items.constBegin(); it != items.constEnd(); ++it ) { new EmailItem( *it, mEmailListBox, preferred ); preferred = false; } // set default state KAcceleratorManager::manage( this ); setInitialSize( QSize( 400, 200 ) ); }
void stdcalc() { double u=0,v=0; /* u:输入的第1个数, v:输入的第2个数 */ int flag=0; /* 输入数据是否有小数点标志:0-无 1-有 */ int sign=0; /* 是否单击了运算符:0-无 其他-运算符字符 */ int x,y; /* (x,y)鼠标当前位置 (xx,yy)鼠标前一位置 */ char s[9]; /* 存储输入的数字符号(含小数点) */ int fget=4; /* 前一次单击的按钮标签 */ int d,dn; /* 当前单击的按钮标签 */ int pn=0; /* 当前键盘输入的标签 */ int i=0,j; standard(); save_as_old_mouse(0,0); outtextxy(OUTX-15,OUTY,"0"); outtextxy(OUTX,OUTY,"."); while(1) /* 单击右键则退出简单计算器 */ { if (kbhit()!=0) pn=bioskey(0); if (rightpress()==1||pn==0x11b) {mode=-1;break;} if(leftpress()!=1 && pn==0) /* 鼠标左键未单击的处理 */ { move_mouse(); } else if(MouseLeftFlag==1||pn!=0) /* 鼠标左键单击的处理 */ { if(MouseLeftFlag==1){ MouseLeftFlag=0; /* 置标志为0,防止单击1次左键而多次进入 */ get_mouse_position(&x,&y); d=returnstdkey(x,y); /* 得到单击按钮的标签 */ } else { d=stdgetKey(pn); pn=0; } if(d==-1) continue; if(d==20||d==21||d==22||d==23) {if(d==20) mode=1;if(d==21) mode=2;if(d==22) mode=3;if(d==23) mode=4; break;} show(std[d][0],std[d][2],std[d][1],std[d][3]); if(d==4) /* 单击C开始使用 */ { clearscreen(); outtextxy(OUTX-15,OUTY,"0"); outtextxy(OUTX,OUTY,"."); v=u=0; sign=0; flag=0; i=0; } else if((dn=checknum(d,0))!=-1) /* 单击'0'-'9'数字键的处理 */ { if(dn==0&&u==0&&flag==0) /* 开始时始终单击'0',就显示0 */ { i=0; s[i++]=itoc(dn); s[i++]='.'; s[i]='\0'; u=atof(s); outch(u); } else { if(fget==4||fget==19||fget==3||fget==9) { clearscreen(); i=0; s[i++]=itoc(dn); s[i++]='.'; s[i]='\0'; u=atof(s); outch(u); } if(checknum(fget,0)!=-1) { if(sign==0) /* 未单击运算符,处理第1个数u */ { if(flag==0) /* 输入数据无小数点 */ { clearscreen(); u=u*10+d-'0'; if((u>0&&u<1e8)||(u<0&&u>-1e8)) { s[--i]=itoc(dn); s[++i]='.'; s[++i]='\0'; u=atof(s); outch(u); } else outch(u); } if(flag==1) /* 输入数据有小数点 */ { if(i<=8) { clearscreen(); s[i]=itoc(dn); s[++i]='\0'; u=atof(s); outch(u); } } } if(sign!=0) /* 单击了运算符,处理第2个数v */ { if(flag==0) { clearscreen(); v=v*10+d-'0'; if((v>0&&v<1e8)||(v<0&&v>-1e8)) { s[--i]=itoc(dn); s[++i]='.'; s[++i]='\0'; v=atof(s); outch(v); } else outch(v); } if(flag==1) { if(i<=8) { clearscreen(); s[i++]=itoc(dn); s[i]='\0'; v=atof(s); outch(v); } } } } if(fget==8||fget==13||fget==14||fget==18) { clearscreen(); i=0; s[i++]=itoc(dn); s[i++]='.'; s[i]='\0'; v=atof(s); outch(v); } if(fget==17) /* 前一次单击的是小数点按钮 */ { clearscreen(); s[i]=itoc(dn); s[++i]='\0'; if(sign==0) { u=atof(s); outch(u); } if(sign!=0) { v=atof(s); outch(v); } } } } else if(d==8||d==13||d==14||d==18) { /* 单击加,减,乘,除按钮的处理 */ if(sign!=0) { if(fget==8||fget==13||fget==14||fget==18); else { if(sign==14&&v==0) { clearscreen(); outtextxy(OUTX-15,OUTY,"Err"); } else{ u=calculate(u,v,sign); outch(u); } } } sign=d; flag=0; i=0; } else if(d==19) /* 单击等号按钮的处理 */ { if(sign!=0) { if(sign=='/'&&fabs(v)<1e-6) { clearscreen(); outtextxy(OUTX-15,OUTY,"Err"); } else { u=calculate(u,v,sign); outch(u); } } flag=0; sign=0; i=0; } else if(d==17) /* 单击小数点按钮的处理 */ { if(flag==0) flag=1; } else if(d==3) /* 单击1/x按钮的处理 */ { if(sign==0) /* 如果是第1个数,输出u的百分数 */ {if(fabs(u)>1e-6) {u=1/u; outch(u);} else {clearscreen(); outtextxy(OUTX-15,OUTY,"Err");}} if(sign!=0) /* 是第2个数(单击过运算符),输出v的百分数 */ {if(fabs(v)>1e-6) {v=1/v; outch(v);} else {clearscreen(); outtextxy(OUTX-15,OUTY,"Err");}} i=0; } else if(d==9) /* 单击求平方根按钮的处理 */ { if(sign==0) /*对输入的第1个数求平方根 */ { if(u<0) { clearscreen(); outtextxy(OUTX-15,OUTY,"Err"); } else{ u=sqrt(u); outch(u); } } if(sign!=0) /*对输入的第2个数求平方根 */ { if(v<0) { clearscreen(); outtextxy(OUTX-15,OUTY,"Er"); } else{ v=sqrt(v); outch(v); } } i=0; } else if(d==16) /* 单击+/-按钮的处理 */ { if(sign==0) { u=-u; outch(u); } else { v=-v; outch(v); } } else continue; fget=d; /* 保存上次单击按钮的标签 */ } /* End of else if(MouseLeftFlag==1) */ } /* End of while(rightpress()!=2) */ }
void Strobe::every8() { if (beatcounter%8 == 0 && counter < (double) targetCycles / 2) { standard(); } }
int main() { srand(time(0)); // seed random number // intialize variables int num_tests = 100; int vector_size = 10000; // vectors to hold execution times int shell_times[num_tests]; int bubble_times[num_tests]; int insertion_times[num_tests]; int standard_times[num_tests]; std::cout << "Testing " << num_tests << " loops of sorting " << vector_size << " values:" << std::endl; for (int i=0; i < num_tests; i++) { std::cout << "\r" << (int)(((double)i/num_tests)*100) << "%" << std::flush; StopWatch sw; std::vector<int> shell(vector_size); // intialize a vector to random values for (int i=0; i < vector_size; i++) shell[i] = rand(); // verify that the original array is unsorted if (std::is_sorted(shell.begin(), shell.end())) break; // copy to other vectors std::vector<int> bubble(shell.begin(), shell.end()); std::vector<int> insertion(shell.begin(), shell.end()); std::vector<int> standard(shell.begin(), shell.end()); // test shell sw.start(); shellsort(shell); shell_times[i] = sw.pause(); // test bubble sw.start(); bubblesort(bubble.begin(), bubble.end()); bubble_times[i] = sw.pause(); // test insertion sw.start(); InsertionSort(insertion); insertion_times[i] = sw.pause(); // test standard sw.start(); std::sort(standard.begin(), standard.end()); standard_times[i] = sw.pause(); } std::cout << "\r100%" << std::flush << std::endl << std::endl; print("shell", shell_times, num_tests); print("bubble", bubble_times, num_tests); print("insertion", insertion_times, num_tests); print("standard", standard_times, num_tests); std::cout << std::endl; return 0; }
//------------------------------------------------------------------------------ //! int main( int argc, char* argv[] ) { // Make sure all of the required collections exist. standard(); special(); RCP<Collection> sel = new Collection( "", "" ); Result res; if( argc > 1 ) { for( int argi = 1; argi < argc; ++argi ) { String arg = String( argv[argi] ); if( arg == "-list" || arg == "-l" ) { String prefix; if( argc > argi ) { prefix = argv[argi+1]; } _std->printInfo( prefix ); printf("\n"); _spc->printInfo( prefix ); printf("\n"); return 0; } else { Test* test = _std->find( arg ); if( test == NULL ) { test = _spc->find( arg ); } if( test != NULL ) { sel->add( test ); } else { printf( "ERROR - '%s' not found\n", arg.cstr() ); return 2; } } } if( !sel->tests().empty() ) { sel->run( res ); } } else { _std->run( res ); } #if _MSC_VER // Prevent VS from closing terminal window. fflush( NULL ); getchar(); #endif return (res.failures() == 0) ? 0 : 1; }
const HeaderStrategy * next() const { return standard(); }
KeyMap KeyMap::fromName(const QString &name){ QStringList list = name.trimmed().split(" "); if(list.length() != 2) return KeyMap(); return standard(getModel(list[0]), getLayout(list[1])); }
const HeaderStrategy * prev() const { return standard(); }
int main() { standard(); return 0; }
int main (void) { standard (); return 0; }
int best_option(char* Maze, int start) { int* U_$; int* Add_$; int U_R = sdistance(Maze, start, 2650), min; U_$ = (int*)malloc(sizeof(int)*100); Add_$ = (int*)malloc(sizeof(int)*100); int i =0,j=0; while(i<2704) { if(Maze[i] == '$') { U_$[j] = sdistance(Maze, start, i); Add_$[j] = i; j++; } i++; } U_$[j] = -10; //termination constant j = 0; min = U_$[j]; int minadd = Add_$[j]; for(j=0; U_$[j] != -10; j++) { if(min > U_$[j]) {min = U_$[j]; minadd = Add_$[j];} } int E = posn(Maze, 'E'); int E_R = sdistance(Maze, E, 2650); int* E_$; E_$ = (int*)malloc(sizeof(int)*100); i =0,j=0; while(i<2704) { if(Maze[i] == '$') { E_$[j] = sdistance(Maze, E, i); j++; } i++; } E_$[j] = -10; //termination constant /* * Now here, starts the bot algorithm The decisive part of the bot which decides * which point towards should the move be intended for */ /* * If distance between U and R is less than that between E and R * and provided E cant take 5 $ before U reaches R, go straight for R */ if(U_R < dist_calc(E_$,5) && U_R < E_R) return 2650; /* * If distance between U and R is less than that between E and R * and provided E can reach 5 $ before U reaches R. */ else if(U_R < E_R && U_R > dist_calc(E_$,5)) { // If U can reach a $ and still be close to R than E go take that $ if(min + sdistance(Maze,minadd,2650) < E_R) return minadd; // Going towards R while collecting random $ near it (radius 4) // else // return standard(Maze,start); } else if(U_R == E_R) return standard(Maze, start); else if(U_R > E_R) { return minadd; } return 2650; }
int main (int argc, char *argv[]) { int date; char input[10]; char mon[10]; int monidx; int year; int days; int isleap; int total; // obtain a year printf("Enter the year(empty line to quit): "); while(fgets(input, 10, stdin) != NULL && input[0] != '\n') { if (!isdigit(input[0])) { printf("%s is not a valid year. Enter the year again(empty line to quit): ", input); continue; } year = atoi(input); // check if that year is a leap year isleap = leapYear(year); // obtain a valid month printf ("Enter the month (number, name or abbreviation): "); int f; while(fgets(mon, 10, stdin) == NULL || input[0] == '\n' || !(validMonth(monidx = standard(mon)))) { printf("Not a valid input, enter the month (number, name or abbreviation): "); // printf("%d\n",f); } // printf("%d\n",f); // transfer the input to month idx // monidx = standard(mon); // obtain a valid date // days = obtainDays(monidx); printf("Enter the date (1-%d): ",obtainDays(monidx)); while(scanf("%d", &date) <= 0) { if (isleap && monidx == 2) { printf("Not a valid date, please input a valid date(1-29): "); } printf("Not a valid date, please input a valid date(1-%d): ", obtainDays(monidx)); } // calculate the days total = calTotal(monidx, date, isleap); // print the results if (total) { int lastDigit = date % 10; if (lastDigit == 1) { printf("There are %d day(s) through %s %dst from begining of %d.\n", total, months[monidx].name, date, year); } else if(lastDigit == 2) { printf("There are %d day(s) through %s %dnd from begining of %d.\n", total, months[monidx].name, date, year); } else if (lastDigit == 3) { printf("There are %d day(s) through %s %drd from begining of %d.\n", total, months[monidx].name, date, year); } else printf("There are %d day(s) through %s %dth from begining of %d.\n", total, months[monidx].name, date, year); } else printf("Oops, I ate too much today.\n"); while(getchar() != '\n') continue; // Do it again printf("Enter the year(empty line to quit): "); } return 0; }