bool Wheelbrake::clbkLoadPanel2D (int panelid, PANELHANDLE hPanel, DWORD viewW, DWORD viewH) { if (panelid != 0) return false; SURFHANDLE panel2dtex = oapiGetTextureHandle(DG()->panelmesh0,1); DG()->RegisterPanelArea (hPanel, ELID_LEVER, _R(1221,494,1273,557), PANEL_REDRAW_ALWAYS, PANEL_MOUSE_LBDOWN | PANEL_MOUSE_LBUP, panel2dtex, lever); return true; }
bool GearControl::clbkLoadPanel2D (int panelid, PANELHANDLE hPanel, DWORD viewW, DWORD viewH) { if (panelid != 0) return false; SURFHANDLE panel2dtex = oapiGetTextureHandle(DG()->panelmesh0,1); DG()->RegisterPanelArea (hPanel, ELID_LEVER, _R(73,147,105,372), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN, panel2dtex, lever); DG()->RegisterPanelArea (hPanel, ELID_INDICATOR, _R(0,0,0,0), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, panel2dtex, indicator); return true; }
bool MfdSubsystem::clbkLoadPanel2D (int panelid, PANELHANDLE hPanel, DWORD viewW, DWORD viewH) { if (panelid != 0) return false; const int xofs = (mfdid == MFD_LEFT ? 173:736); SURFHANDLE panel2dtex = oapiGetTextureHandle(DG()->panelmesh0,1); DG()->RegisterPanelArea (hPanel, ELID_BTNROW, _R( 51+xofs,359,321+xofs,377), PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_ONREPLAY, panel2dtex, btnrow); // bottom button row DG()->RegisterPanelArea (hPanel, ELID_BTNCOL[0], _R( xofs,100, 25+xofs,323), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, panel2dtex, btncol[0]); // left button column DG()->RegisterPanelArea (hPanel, ELID_BTNCOL[1], _R(348+xofs,100,373+xofs,323), PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY, panel2dtex, btncol[1]); // right button column return true; }
void GearControl::RaiseGear () { extern void UpdateCtrlDialog (DeltaGlider *dg, HWND hWnd=0); gear_state.Close(); glever_state.Close(); DG()->UpdateStatusIndicators(); oapiTriggerPanelRedrawArea (0, ELID_LEVER); oapiTriggerRedrawArea (2, 0, ELID_INDICATOR); UpdateCtrlDialog (DG()); DG()->RecordEvent ("GEAR", "UP"); }
void GearControl::clbkPostStep (double simt, double simdt, double mjd) { // animate landing gear if (gear_state.Process (simdt)) { DG()->SetAnimation (anim_gear, gear_state.State()); DG()->SetGearParameters (gear_state.State()); oapiTriggerRedrawArea (0, 0, ELID_INDICATOR); DG()->UpdateStatusIndicators(); } // animate gear lever if (glever_state.Process (simdt)) { DG()->SetAnimation (anim_gearlever, glever_state.State()); } }
void GearControl::LowerGear () { extern void UpdateCtrlDialog (DeltaGlider *dg, HWND hWnd=0); if (DG()->GroundContact()) return; // we cannot deploy the landing gear if we are already sitting on the ground gear_state.Open(); glever_state.Open(); DG()->UpdateStatusIndicators(); oapiTriggerPanelRedrawArea (0, ELID_LEVER); oapiTriggerRedrawArea (2, 0, ELID_INDICATOR); UpdateCtrlDialog (DG()); DG()->RecordEvent ("GEAR", "DOWN"); }
int main() { int t,i,j,n,m; scanf("%d",&t); while(t--) { scanf("%d %d",&n,&m); for(i=0;i<n;i++) { scanf("%lld",&L[i]); L[i]=L[i]*L[i]; } long long int max=0; for(j=0;j<m;j++) { scanf("%lld %lld %lld",&A[j],&B[j],&C[j]); max=MAX(DG(A[j],B[j],C[j]),max); } int ans=0; for(i=0;i<n;i++) { if(L[i]<=max) ans++; } printf("%d\n",ans); } return 0; }
bool GearControl::clbkLoadVC (int vcid) { if (vcid != 0) return false; SURFHANDLE tex1 = oapiGetTextureHandle (DG()->vcmesh_tpl, 16); // Gear lever oapiVCRegisterArea (ELID_LEVER, PANEL_REDRAW_NEVER, PANEL_MOUSE_LBDOWN); oapiVCSetAreaClickmode_Quadrilateral (ELID_LEVER, VC_GEARLEVER_mousearea[0], VC_GEARLEVER_mousearea[1], VC_GEARLEVER_mousearea[2], VC_GEARLEVER_mousearea[3]); // Gear indicator oapiVCRegisterArea (ELID_INDICATOR, PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE); oapiVCRegisterArea (ELID_INDICATOR, _R(32,127,61,158), PANEL_REDRAW_USER, PANEL_MOUSE_IGNORE, PANEL_MAP_BACKGROUND, tex1); return true; }
void pmminit(struct multiboot_info *mb_info) { DG("PMM: Init..."); pc("[00.000027] +kernel_start = %d", &kernel_start); uint16_t addr = (uint16_t) &kernel_start; pc("[00.000029] +for addr < kernel_end do useMark"); while (addr < (uint16_t) &kernel_end) { pmm_mark_used((void*) addr); addr += 0x1000; } struct multiboot_mmap* mmap = mb_info->mb_mmap_addr; struct multiboot_mmap* mmap_end = (void*) ((uint16_t) mb_info->mb_mmap_addr + mb_info->mb_mmap_length); struct multiboot_module *mod = mb_info->mb_mods_addr; pc("[00.000039] +useMark multibootModule"); pmm_mark_used(mod); int i; void *Maddr; for (i = 0; i < mb_info->mb_mods_count; i++) { Maddr = mod[i].start; while (Maddr < mod[i].end) { pmm_mark_used((void*) Maddr); Maddr += 0x1000; } } while (mmap < mmap_end) { // Der Speicherbereich ist frei, entsprechend markieren uint16_t addr = mmap->base; uint16_t end_addr = addr + mmap->length; if (mmap->type == 1) { // Der Speicherbereich ist frei, entsprechend markieren addr = mmap->base; end_addr = addr + mmap->length; while (addr < end_addr) { free((void*) addr); addr += 0x1000; } } mmap++; } dbg(true); }
bool MfdSubsystem::clbkLoadVC (int vcid) { if (vcid != 0) return false; vctex = oapiGetTextureHandle (DG()->vcmesh_tpl, 20); const double xofs = (mfdid == MFD_LEFT ? -0.2684 : 0.0616); oapiVCRegisterArea (ELID_BTNROW, PANEL_REDRAW_MOUSE, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral (ELID_BTNROW, _V(0.0840+xofs, 1.0745, 7.2238), _V(0.1228+xofs, 1.0745, 7.2238), _V(0.0840+xofs, 1.0587, 7.2180), _V(0.1228+xofs, 1.0587, 7.2180)); oapiVCRegisterArea (ELID_BTNCOL[0], PANEL_REDRAW_MOUSE|PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral (ELID_BTNCOL[0], _V(0+xofs, 1.2155, 7.2751), _V(0.0168+xofs, 1.2155, 7.2751), _V(0+xofs, 1.0963, 7.2317), _V(0.0168+xofs, 1.0963, 7.2317)); oapiVCRegisterArea (ELID_BTNCOL[1], PANEL_REDRAW_MOUSE|PANEL_REDRAW_USER, PANEL_MOUSE_LBDOWN|PANEL_MOUSE_LBUP|PANEL_MOUSE_LBPRESSED|PANEL_MOUSE_ONREPLAY); oapiVCSetAreaClickmode_Quadrilateral (ELID_BTNCOL[1], _V(0.1900+xofs, 1.2155, 7.2751), _V(0.2068+xofs, 1.2155, 7.2751), _V(0.1900+xofs, 1.0963, 7.2317), _V(0.2068+xofs, 1.0963, 7.2317)); return true; }
Matrix DependentGrapth() { Matrix DG(4, 4, 0.0); DG(0,0) = 1; DG(0,1) = 1; DG(0,2) = 0; DG(0,3) = 0; DG(1,0) = 1; DG(1,1) = 1; DG(1,2) = 1; DG(1,3) = 1; DG(2,0) = 1; DG(2,1) = 1; DG(2,2) = 1; DG(2,3) = 1; DG(3,0) = 0; DG(3,1) = 0; DG(3,2) = 1; DG(3,3) = 1; return DG; }
Matrix DependentGrapth() { Matrix DG(5, 5, 0.0); DG(0,0) = 0; DG(0,1) = 1; DG(0,2) = -1; DG(1,0) = 0; DG(1,1) = 1; DG(1,2) = 2; DG(1,3) = 3; DG(1,4) = -1; DG(2,0) = 0; DG(2,1) = 1; DG(2,2) = 2; DG(2,3) = 3; DG(2,4) = -1; DG(3,0) = 2; DG(3,1) = 3; DG(3,2) = -1; return DG; }
GearControl::GearControl (GearSubsystem *_subsys) : DGSubsystem(_subsys) { gear_state.SetOperatingSpeed (GEAR_OPERATING_SPEED); glever_state.SetOperatingSpeed (4.0); ELID_LEVER = AddElement (lever = new GearLever (this)); ELID_INDICATOR = AddElement (indicator = new GearIndicator (this)); // Landing gear animation static UINT NWheelStrutGrp[2] = {GRP_NWheelStrut1,GRP_NWheelStrut2}; static MGROUP_ROTATE NWheelStrut (0, NWheelStrutGrp, 2, _V(0,-1.048,8.561), _V(1,0,0), (float)(-95*RAD)); static UINT NWheelFCoverGrp[2] = {GRP_NWheelFCover1,GRP_NWheelFCover2}; static MGROUP_ROTATE NWheelFCover (0, NWheelFCoverGrp, 2, _V(0,-1.145,8.65), _V(1,0,0), (float)(-90*RAD)); static UINT NWheelLCoverGrp[2] = {GRP_NWheelLCover1,GRP_NWheelLCover2}; static MGROUP_ROTATE NWheelLCover1 (0, NWheelLCoverGrp, 2, _V(-0.3,-1.222,7.029), _V(0,0.052,0.999), (float)(-90*RAD)); static MGROUP_ROTATE NWheelLCover2 (0, NWheelLCoverGrp, 2, _V(-0.3,-1.222,7.029), _V(0,0.052,0.999), (float)( 90*RAD)); static UINT NWheelRCoverGrp[2] = {GRP_NWheelRCover1,GRP_NWheelRCover2}; static MGROUP_ROTATE NWheelRCover1 (0, NWheelRCoverGrp, 2, _V( 0.3,-1.222,7.029), _V(0,0.052,0.999), (float)( 90*RAD)); static MGROUP_ROTATE NWheelRCover2 (0, NWheelRCoverGrp, 2, _V( 0.3,-1.222,7.029), _V(0,0.052,0.999), (float)(-90*RAD)); static UINT LWheelStrutGrp[2] = {GRP_LWheelStrut1,GRP_LWheelStrut2}; static MGROUP_ROTATE LWheelStrut (0, LWheelStrutGrp, 2, _V(-3.607,-1.137,-3.08), _V(0,0,1), (float)(-90*RAD)); static UINT RWheelStrutGrp[2] = {GRP_RWheelStrut1,GRP_RWheelStrut2}; static MGROUP_ROTATE RWheelStrut (0, RWheelStrutGrp, 2, _V( 3.607,-1.137,-3.08), _V(0,0,1), (float)(90*RAD)); static UINT LWheelOCoverGrp[4] = {GRP_LWheelOCover1,GRP_LWheelOCover2,GRP_LWheelOCover3,GRP_LWheelOCover4}; static MGROUP_ROTATE LWheelOCover (0, LWheelOCoverGrp, 4, _V(-3.658,-1.239,-3.038), _V(0,0,1), (float)(-110*RAD)); static UINT LWheelICoverGrp[2] = {GRP_LWheelICover1,GRP_LWheelICover2}; static MGROUP_ROTATE LWheelICover1 (0, LWheelICoverGrp, 2, _V(-2.175,-1.178,-3.438), _V(0,0,1), (float)(90*RAD)); static MGROUP_ROTATE LWheelICover2 (0, LWheelICoverGrp, 2, _V(-2.175,-1.178,-3.438), _V(0,0,1), (float)(-90*RAD)); static UINT RWheelOCoverGrp[4] = {GRP_RWheelOCover1,GRP_RWheelOCover2,GRP_RWheelOCover3,GRP_RWheelOCover4}; static MGROUP_ROTATE RWheelOCover (0, RWheelOCoverGrp, 4, _V( 3.658,-1.239,-3.038), _V(0,0,1), (float)( 110*RAD)); static UINT RWheelICoverGrp[2] = {GRP_RWheelICover1,GRP_RWheelICover2}; static MGROUP_ROTATE RWheelICover1 (0, RWheelICoverGrp, 2, _V( 2.175,-1.178,-3.438), _V(0,0,1), (float)(-90*RAD)); static MGROUP_ROTATE RWheelICover2 (0, RWheelICoverGrp, 2, _V( 2.175,-1.178,-3.438), _V(0,0,1), (float)( 90*RAD)); anim_gear = DG()->CreateAnimation (1); DG()->AddAnimationComponent (anim_gear, 0.3, 1, &NWheelStrut); DG()->AddAnimationComponent (anim_gear, 0.3, 0.9, &NWheelFCover); DG()->AddAnimationComponent (anim_gear, 0, 0.3, &NWheelLCover1); DG()->AddAnimationComponent (anim_gear, 0.7, 1.0, &NWheelLCover2); DG()->AddAnimationComponent (anim_gear, 0, 0.3, &NWheelRCover1); DG()->AddAnimationComponent (anim_gear, 0.7, 1.0, &NWheelRCover2); DG()->AddAnimationComponent (anim_gear, 0, 1, &LWheelStrut); DG()->AddAnimationComponent (anim_gear, 0, 1, &RWheelStrut); DG()->AddAnimationComponent (anim_gear, 0, 1, &LWheelOCover); DG()->AddAnimationComponent (anim_gear, 0, 0.3, &LWheelICover1); DG()->AddAnimationComponent (anim_gear, 0.7, 1, &LWheelICover2); DG()->AddAnimationComponent (anim_gear, 0, 1, &RWheelOCover); DG()->AddAnimationComponent (anim_gear, 0, 0.3, &RWheelICover1); DG()->AddAnimationComponent (anim_gear, 0.7, 1, &RWheelICover2); // VC gear lever animation static UINT GearLeverGrp = GRP_GEAR_LEVER_VC; static MGROUP_ROTATE GearLeverTransform (1, &GearLeverGrp, 1, VC_GEARLEVER_ref, VC_GEARLEVER_axis, (float)(-70*RAD)); anim_gearlever = DG()->CreateAnimation (0.5); DG()->AddAnimationComponent (anim_gearlever, 0, 1, &GearLeverTransform); }
void GearControl::clbkPostCreation () { DG()->SetAnimation (anim_gear, gear_state.State()); DG()->SetAnimation (anim_gearlever, glever_state.State()); DG()->SetGearParameters (gear_state.State()); }
baseline_reml::baseline_reml(MCMCoptions * o, const datamatrix & d, const datamatrix & leftint, const datamatrix & lefttrunc, const unsigned & nrk, const unsigned & degr, const unsigned & tgr, const unsigned & nrq, const unsigned & nrb, const knotpos & kp, const fieldtype & ft, const ST::string & ti, const ST::string & fp, const ST::string & pres, const double & l, const double & sl, const knotpos & gp, const int & gs, const bool & catsp, const double & rv) : spline_basis(o,d,nrk,degr,kp,ft,ti,fp,pres,l,sl,catsp,0.0,0.0,0.0,0.0,gs,rv) { unsigned i,j,k; baseline=true; varcoeff=false; // refcheck=false; gridpos = gp; double tmax=d.max(0); if(gridpos == MCMC::equidistant) { tgrid = tgr; tvalues = datamatrix(tgrid+1,1); tstep = tmax / tgrid; for(i=0;i<tvalues.rows();i++) tvalues(i,0) = i*tstep; } else if(gridpos == MCMC::quantiles) { tgrid = nrq*nrb; tvalues = datamatrix(tgrid+1,1); nrquant = nrq; nrbetween = nrb; datamatrix tquantiles = datamatrix(nrquant+1,1,0); for(i=1; i<nrquant; i++) { tquantiles(i,0) = d.quantile(((double)i/nrquant)*100,0); } tquantiles(nrquant,0) = tmax; double intmax, intmin, intstep; for(i=0; i<nrquant; i++) { intmin=tquantiles(i,0); intmax=tquantiles(i+1,0); intstep=(intmax-intmin)/nrbetween; for(j=0; j<nrbetween; j++) { tvalues(i*nrbetween+j,0) = intmin + j*intstep; } } tvalues(tgrid,0) = tmax; } else { make_index(d); vector<int>::iterator freqwork = freqoutput.begin(); int * workindex = index.getV(); tvalues = datamatrix(nrdiffobs,1,0); for(j=0;j<d.rows();j++,freqwork++,workindex++) if(freqwork==freqoutput.begin() || *freqwork!=*(freqwork-1)) tvalues(*freqwork,0) = d(*workindex,0); } tsteps = datamatrix(tvalues.rows()-1,1,0); for(i=0; i<tsteps.rows(); i++) tsteps(i,0) = tvalues(i+1,0)-tvalues(i,0); interact_var = datamatrix(d.rows(),1,1); datamatrix betahelp(nrpar,1,0); DG = datamatrix(tvalues.rows(),degree+1,0); DGfirst = vector<int>(tvalues.rows()); for(i=0;i<tvalues.rows();i++) { betahelp.assign( bspline(tvalues(i,0)) ); j=degree+1; while(knot[j] <= tvalues(i,0) && j<nrknots+degree) j++; for(k=0;k<degree+1;k++) DG(i,k) = betahelp(k+j-(degree+1),0); DGfirst[i] = j-(degree+1); } tleft = vector<unsigned>(d.rows(),0); tright = vector<unsigned>(d.rows(),1); ttrunc = vector<unsigned>(d.rows(),0); // indices for truncation times if(lefttrunc.rows()>1) { for(i=0; i<lefttrunc.rows(); i++) { j=1; while(j<tvalues.rows() && tvalues(j,0) < lefttrunc(i,0)) { ttrunc[i]++; j++; } } } for(i=0; i<d.rows(); i++) { j=0; while(j<tvalues.rows()-2 && tvalues(j,0)<d(i,0)) { tright[i]++; j++; } } if(leftint.rows()>1) { for(i=0; i<d.rows(); i++) { if( leftint(i,0) < d(i,0)) { j=0; while(j<tvalues.rows()-1 && tvalues(j,0)<leftint(i,0)) { tleft[i]++; j++; } } else if(leftint(i,0)> d(i,0)) { tleft[i] = tright[i]+1; } else { tleft[i] = tright[i]; } } } else { for(i=0; i<d.rows(); i++) { tleft[i] = tright[i]; } } }