#include #include #include #include void testFrustum(double left,double right,double bottom,double top,double zNear,double zFar) { osg::Matrix f; f.makeFrustum(left,right,bottom,top,zNear,zFar); double c_zNear = f(3,2) / (f(2,2)-1.0f); double c_zFar = f(3,2) / (1.0f+f(2,2)); double c_left = c_zNear * (f(2,0)-1.0f) / f(0,0); double c_right = c_zNear * (1.0f+f(2,0)) / f(0,0); double c_top = c_zNear * (1+f(2,1)) / f(1,1); double c_bottom = c_zNear * (f(2,1)-1.0f) / f(1,1); f.getFrustum(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar); std::cout << "testFrustum"<setDescription(arguments.getApplicationName()+" is the example which runs units tests."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests."); arguments.getApplicationUsage()->addCommandLineOption("matrix","Display qualified tests."); if (arguments.argc()<=1) { arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); return 1; } bool printQualifiedTest = false; while (arguments.read("qt")) printQualifiedTest = true; bool displayMatrixTest = false; while (arguments.read("matrix")) displayMatrixTest = true; // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { std::cout<getCommandLineUsage()<write(std::cout,arguments.getApplicationUsage()->getCommandLineOptions()); return 1; } // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); // report any errors if they have occured when parsing the program aguments. if (arguments.errors()) { arguments.writeErrorMessages(std::cout); return 1; } if (displayMatrixTest) { std::cout<<"****** Running matrix tests ******"<accept( printer ); std::cout<accept( runner ); return 0; }