#include #include #include #include #include #include #include "performance.h" #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_left=0; double c_right=0; double c_top=0; double c_bottom=0; double c_zNear=0; double c_zFar=0; std::cout << "testFrustum"< eps || (fabs(out_quat1.x())-fabs(out_quat2.x())) > eps || (fabs(out_quat1.y())-fabs(out_quat2.y())) > eps || (fabs(out_quat1.z())-fabs(out_quat2.z())) > eps || (fabs(out_quat1.w())-fabs(out_quat2.w())) > eps) { std::cout << "problem at: r1=" << rol1 << " p1=" << pit1 << " y1=" << yaw1 << " r2=" << rol2 << " p2=" << pit2 << " y2=" << yaw2 << "\n"; std::cout << "quats: " << out_quat1 << " length: " << out_quat1.length() << "\n"; std::cout << "mats and get: " << out_quat2 << " length: " << out_quat2.length() << "\n\n"; } } } } } } } } void testQuatRotate(const osg::Vec3d& from, const osg::Vec3d& to) { osg::Quat q_nicolas; q_nicolas.makeRotate(from,to); osg::Quat q_original; q_original.makeRotate_original(from,to); std::cout<<"osg::Quat::makeRotate("<setCommandLineUsage(arguments.getApplicationName()+" [options]"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests."); arguments.getApplicationUsage()->addCommandLineOption("sizeof","Display sizeof tests."); arguments.getApplicationUsage()->addCommandLineOption("matrix","Display qualified tests."); arguments.getApplicationUsage()->addCommandLineOption("performance","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 printMatrixTest = false; while (arguments.read("matrix")) printMatrixTest = true; bool printSizeOfTest = false; while (arguments.read("sizeof")) printSizeOfTest = true; bool printQuatTest = false; while (arguments.read("quat")) printQuatTest = true; bool performanceTest = false; while (arguments.read("p") || arguments.read("performance")) performanceTest = 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 (printQuatTest) { testQuat(); } if (printMatrixTest) { std::cout<<"****** Running matrix tests ******"<accept( printer ); std::cout<accept( runner ); return 0; }