int main(int argc, char** argv) { ros::init(argc, argv, "multiquad_script_test"); ros::NodeHandle node; ros::Rate rate(FRAMES_PER_SEC); // Create quads Quad quad1("quad01"); Quad quad2("quad02"); // Group quads together Formation form; form.add_quad(quad1); form.add_quad(quad2); // form.add_script<Takeoff>(new Takeoff(0.0)); ROS_INFO("Boundary checking starting..."); while(node.ok()) { form.run(); rate.sleep(); } return 0; }
int main(void) { double a, b, c; printf("Input a? "); scanf("%lf", &a); printf("Input b? "); scanf("%lf", &b); printf("Input c? "); scanf("%lf", &c); quad1(a, b, c); return 0; }
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) int main(int _argc, char** _argv) { EEDesc desc; desc.applicationName = L"Emerald"; //窗口名称 desc.isFullScreen = false; //是否全屏 desc.width = 800; //窗口宽度 desc.height = 450; //窗口高度 desc.isSSAA = true; //是开启抗锯齿 desc.isVsync = false; //是否垂直同步 EEInitialize(desc); EEBitmap bitmap1 = EEGetFontBitmap(L'啊'); EEBitmap bitmap2 = EEGetFontBitmap(L'呀'); EEBitmap bitmap3 = EEGetFontBitmap(L'?'); EEBitmap bitmap = EEBitmapCombineHorizontal(bitmap1, bitmap2); //bitmap = EEBitmapCombineHorizontal(bitmap, bitmap3); //bitmap.Resize(500, 500); //std::vector<EEBitmap> bitmaps; //EEBitmapDivideVertical(bitmap, 3, bitmaps); //EETexture fonttex(bitmaps[1]); EEQuad2D quad0(Rect_Float(0, 0, (float)bitmap.GetWidth(), (float)bitmap.GetHeight()), bitmap); quad0.SetLocalZOrder(10.0f); EEBitmap bitmap11 = EEGetFontBitmap(L"大家好!呀\n呀\'呀呀?"); EEQuad2D quad1(Rect_Float(0, 200, (float)bitmap11.GetWidth(), (float)bitmap11.GetHeight() + 200), bitmap11); quad1.SetLocalZOrder(10.0f); EETexture bgTex(L"Texture\\Project Diva Freedom\\01\\选歌条.png"); EEFont helloworld(FLOAT3(100.0f, 100.0f, 0.0f), EEColor::YELLOW, L"hello world"); helloworld.AddText(L'1'); EELineEditor *lineEditor = new EELineEditor(Rect_Float(200.f, 300.f, 300.f, 350.f), bgTex, EEColor::BLACK); EELineEditor *lineEditor2 = new EELineEditor(Rect_Float(400.f, 300.f, 500.f, 350.f), bgTex, EEColor::BLACK); EETextEditor *textEditor = new EETextEditor(Rect_Float(300.f, 100.f, 400.f, 150.f), bgTex, EEColor::BLACK); while (EERun()) { EEBeginScene(EEColor::BLACK); EEShowFPSInTitle(L"- -"); quad0.Process(); quad1.Process(); lineEditor->Process(); lineEditor2->Process(); helloworld.Process(); textEditor->Process(); EEEndScene(); } EEShutdown(); return 0; }
std::vector<std::vector<int> > getFeatures(std::vector<cv::Mat> imLBP){ int m = imLBP[0].rows / 2; int n = imLBP[0].cols / 2; std::vector<int> bins = initHistogram(); std::vector<std::vector<int> > features; for (unsigned int k = 0; k < imLBP.size(); k++){ cv::Mat quad1(m, n, CV_8U); cv::Mat quad2(m, n, CV_8U); cv::Mat quad3(m, n, CV_8U); cv::Mat quad4(m, n, CV_8U); for (int i = 0; i < m; i++){ for (int j = 0; j < n; j++){ quad1.at<uchar>(i, j) = imLBP[k].at<uchar>(i, j); quad2.at<uchar>(i, j) = imLBP[k].at<uchar>(i, j+n); quad3.at<uchar>(i, j) = imLBP[k].at<uchar>(i+m, j); quad4.at<uchar>(i, j) = imLBP[k].at<uchar>(i+m, j+n); } } std::vector<int> histLBP_1 = histLBP(quad1, bins); std::vector<int> histLBP_2 = histLBP(quad2, bins); std::vector<int> histLBP_3 = histLBP(quad3, bins); std::vector<int> histLBP_4 = histLBP(quad3, bins); std::vector<int> feature; feature.reserve(histLBP_1.size() + histLBP_2.size() + histLBP_3.size() + histLBP_4.size()); feature.insert(feature.end(), histLBP_1.begin(), histLBP_1.end()); feature.insert(feature.end(), histLBP_2.begin(), histLBP_2.end()); feature.insert(feature.end(), histLBP_3.begin(), histLBP_3.end()); feature.insert(feature.end(), histLBP_4.begin(), histLBP_4.end()); features.push_back(feature); } return features; }
Region& Region::Exclude(const Rect &excludeRect) { BeginOperation(); int index = 0; int rectsToCheck = fNumRects; while (index < rectsToCheck) { Rect &clipRect = fRects[index]; if (!excludeRect.Intersects(clipRect)) { index++; continue; } // This clip rect intersects the excluded rect, and could be divided into // as many as eight pieces. Test for each case. Note that none of these // rectangles overlap!!!! Rect quad1(clipRect.left, clipRect.top, excludeRect.left - 1, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad1)) { quad1.Intersect(clipRect); AddRect(quad1); } Rect quad2(excludeRect.left, clipRect.top, excludeRect.right, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad2)) { quad2.Intersect(clipRect); AddRect(quad2); } Rect quad3(excludeRect.right + 1, clipRect.top, clipRect.right, excludeRect.top - 1); if (SPLIT_TEST(clipRect, quad3)) { quad3.Intersect(clipRect); AddRect(quad3); } Rect quad4(clipRect.left, excludeRect.top, excludeRect.left - 1, excludeRect.bottom); if (SPLIT_TEST(clipRect, quad4)) { quad4.Intersect(clipRect); AddRect(quad4); } Rect quad5(excludeRect.right + 1, excludeRect.top, clipRect.right, excludeRect.bottom); if (SPLIT_TEST(clipRect, quad5)) { quad5.Intersect(clipRect); AddRect(quad5); } Rect quad6(clipRect.left, excludeRect.bottom + 1, excludeRect.left - 1, clipRect.bottom); if (SPLIT_TEST(clipRect, quad6)) { quad6.Intersect(clipRect); AddRect(quad6); } Rect quad7(excludeRect.left, excludeRect.bottom + 1, excludeRect.right, clipRect.bottom); if (SPLIT_TEST(clipRect, quad7)) { quad7.Intersect(clipRect); AddRect(quad7); } Rect quad8(excludeRect.right + 1, excludeRect.bottom + 1, clipRect.right, clipRect.bottom); if (SPLIT_TEST(clipRect, quad8)) { quad8.Intersect(clipRect); AddRect(quad8); } // This rect has been split, remove it. Note we don't // change the index RemoveRect(index); rectsToCheck--; } EndOperation(); return *this; }
int main(int argc, char** argv) { // ROS initialization stuff ros::init(argc, argv, "quadscript_example"); ros::NodeHandle node; // Set the rate to run everything at. FRAMES_PER_SEC is set in // constants_config.h ros::Rate rate(FRAMES_PER_SEC); // Create Quad objects with the namespace corresponding to the // actual quadcopter, or the type of fake quad for FakeQuads. FakeQuad fake(WAND_MOVABLE); Quad quad1("quad01"); Quad quad2("quad02"); // Add quads to a formation to give them access to each other and // make group movements easier. Formation form; form.add_quad(fake); form.add_quad(quad1); form.add_quad(quad2); // Tells the entire formation to takeoff to the specified height. // Does not do anything for any FakeQuads in the formation. form.add_script<Takeoff>(new Takeoff(0.5)); // Sets quad1 to the specified position (first 3), with the specified // orientation quaternion (last 4) quad1.add_script(new SetPose(-1, -0.7, 0.5, 0, 0, 0, -1)); // Sets quad1's most recently added script to need a wand check, meaning // it won't move on to the next script until the wand signal is given. quad1.back()->set_needsWandCheck(true); // Same for quad2 quad2.add_script(new SetPose(-1, 0.7, 0.5, 0, 0, 0, -1)); quad2.back()->set_needsWandCheck(true); // Sets quads to follow the 0th index quad in the formation (last arg of ctor), // with the offset (x, y, z) specified in first 3 args. // 0th index quad in the formation is a WAND_MOVABLE FakeQuad, so the quads // will follow the imaginary point set by the FakeQuad. quad1.add_script(new FollowOffset(0.6, 0, 0, 0)); quad2.add_script(new FollowOffset(-0.6, 0, 0, 0)); // View QuadScripts.h for more details and documentation of how to // use specific scripts ROS_INFO("Starting..."); // Loops FRAMES_PER_SEC times per second, running the publisher in each active // QuadScript every time. Instead of form.run(), can also use quad#.run() for // individual quads. while(node.ok()) { form.run(); rate.sleep(); } return 0; }
int main(int argc, char *argv[]) { int ierr = 0; #ifdef EPETRA_MPI // Initialize MPI MPI_Init(&argc,&argv); Epetra_MpiComm Comm(MPI_COMM_WORLD); #else Epetra_SerialComm Comm; #endif bool verbose = false; // Check if we should print results to standard out if (argc>1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true; int verbose_int = verbose ? 1 : 0; Comm.Broadcast(&verbose_int, 1, 0); verbose = verbose_int==1 ? true : false; int MyPID = Comm.MyPID(); int NumProc = Comm.NumProc(); if (verbose && MyPID==0) cout << Epetra_Version() << endl << endl; if (verbose) cout << Comm <<endl; int NumVectors = 1; int NumMyElements = 4; int NumGlobalElements = NumMyElements*NumProc; int IndexBase = 0; Epetra_Map Map(NumGlobalElements, NumMyElements, IndexBase, Comm); EPETRA_TEST_ERR( quad1(Map, verbose), ierr); EPETRA_TEST_ERR( quad2(Map, verbose), ierr); EPETRA_TEST_ERR( MultiVectorTests(Map, NumVectors, verbose), ierr); bool preconstruct_graph = false; EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr); preconstruct_graph = true; EPETRA_TEST_ERR( four_quads(Comm, preconstruct_graph, verbose), ierr); #ifdef EPETRA_MPI MPI_Finalize(); #endif return ierr; }
//---------------------------------------------------------------------------------------------------- DIVAGame::DIVAGame(NoteMap _noteMap) : m_isStart(false), m_currentTime(0.f), m_totalTime(0.f), m_noteTime(0.f), m_noteTimeForward(0.f), m_singleTime(0.f), m_distanceTime(0.f), m_noteMap(_noteMap), m_notes(), m_emitter(), circleTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Circle.png"), crossTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Cross.png"), squareTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Square.png"), triangleTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal/Normal-Triangle.png"), rightTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Right.png"), leftTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Left.png"), downTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Down.png"), upTex(L"Texture/Project Diva Freedom/自由模式/NOTE/NOTE/Normal-Array/Normal-Array Up.png"), stripBlueTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Blue.png"), stripGreenTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Green.png"), stripPinkTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Pink.png"), stripRedTex(L"Texture/Project Diva Freedom/自由模式/NOTE/Strip/Strip/Strip-Red.png") { EETexture hitTex[34] = { L"Texture/Project Diva Freedom/自由模式/HIT/effect30.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect29.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect28.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect27.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect26.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect25.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect24.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect23.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect22.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect21.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect20.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect19.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect18.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect17.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect16.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect15.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect14.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect13.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect12.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect11.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect10.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect9.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect8.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect7.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect6.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect5.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect4.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect3.png", L"Texture/Project Diva Freedom/自由模式/HIT/effect2.png", L"Texture/Project Diva Freedom/自由模式/HIT/hit-1(线性减淡).png", L"Texture/Project Diva Freedom/自由模式/HIT/hit-2(线性减淡).png", L"Texture/Project Diva Freedom/自由模式/HIT/hit-3(线性减淡).png", L"Texture/Project Diva Freedom/自由模式/HIT/hit-4(线性减淡).png", L"Texture/Project Diva Freedom/自由模式/HIT/sad-01.png", }; // 0 EESlide hitSlide(Rect_Float(-64, -64, 64, 64), hitTex, 29, 0.0f, false); hitSlide.SetInterval(0.05f / 29.f); EEAnimationFrame frame0; frame0.SetObject(hitSlide); frame0.startTime = 0.0f; frame0.duration = 0.05f; // 1 EEQuad2D quad1(Rect_Float(-40, -40, 40, 40), hitTex[29]); //quad1.SetScale(3.0f); EEAnimationFrame frame1; frame1.SetObject(quad1); frame1.startTime = 0.05f; frame1.duration = 0.35f; float alpha11 = 0.0f; float scale11 = 2.0f; frame1.actions.push_back(boost::bind(EEFade, _1, 0.35f, alpha11, _2)); frame1.actions.push_back(boost::bind(EEScale, _1, 0.35f, scale11, _2)); // 2 EEQuad2D quad2(Rect_Float(-40, -40, 40, 40), hitTex[30]); EEAnimationFrame frame2; frame2.SetObject(quad2); frame2.startTime = 0.05f; frame2.duration = 0.05f; float rotation2 = EE_2PI; frame2.actions.push_back(boost::bind(EERotateYX, _1, 0.05f, rotation2, _2, false)); // 3 EEQuad2D quad3(Rect_Float(-50, -50, 50, 50), hitTex[31]); float alpha30 = 0.8f; float alpha31 = 0.0f; quad3.SetAlpha(alpha30); EEAnimationFrame frame3; frame3.SetObject(quad3); frame3.startTime = 0.1f; frame3.duration = 0.05f; frame3.actions.push_back(boost::bind(EEFade, _1, 0.05f, alpha31, _2)); // 4 EEQuad2D quad4(Rect_Float(-50, -50, 50, 50), hitTex[32]); EEAnimationFrame frame4; frame4.SetObject(quad4); frame4.startTime = 0.5f; frame4.duration = 0.07f; float alpha41 = 0.0f; float scale41 = 4.0f; frame4.actions.push_back(boost::bind(EEFade, _1, 0.07f, alpha41, _2)); frame4.actions.push_back(boost::bind(EEScale, _1, 0.07f, scale41, _2)); EEAnimation animation; animation.AddFrame(frame0); animation.AddFrame(frame2); animation.AddFrame(frame3); animation.AddFrame(frame1); animation.AddFrame(frame4); //animation.SetIsLoop(true); m_emitter.SetAnimation(&animation); }