ATVector3D ATVector3D::crossProduct(ATVector3D atv1, ATVector3D atv2) { float x = atv1.getY()*atv2.getZ() - atv1.getZ()*atv2.getY(); float y = atv1.getZ()*atv2.getX() - atv1.getX()*atv2.getZ(); float z = atv1.getX()*atv2.getY() - atv1.getY()*atv2.getX(); ATVector3D atv(x, y, z); return atv; }
ATVector3D ATVector3D::subtractTwoVectors(ATVector3D atv1, ATVector3D atv2) { float x = atv1.x - atv2.x; float y = atv1.y - atv2.y; float z = atv1.z - atv2.z; ATVector3D atv(x, y, z); return atv; }
int main( int argc, char **argv ) { // use an ArgumentParser object to manage the program arguments. osg::ArgumentParser arguments(&argc,argv); // set up the usage document, in case we need to print out how to use this program. arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters"); arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available"); //arguments.getApplicationUsage()->addCommandLineOption("--formats","List supported file formats"); //arguments.getApplicationUsage()->addCommandLineOption("--plugins","List database olugins"); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { osg::setNotifyLevel(osg::NOTICE); usage( arguments.getApplicationName().c_str(), 0 ); //arguments.getApplicationUsage()->write(std::cout); return 1; } if (arguments.read("--help-env")) { arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE); return 1; } if (arguments.read("--plugins")) { osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); for(osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) { std::cout<<"Plugin "<<*itr<<std::endl; } return 0; } std::string plugin; if (arguments.read("--plugin", plugin)) { osgDB::outputPluginDetails(std::cout, plugin); return 0; } std::string ext; if (arguments.read("--format", ext)) { plugin = osgDB::Registry::instance()->createLibraryNameForExtension(ext); osgDB::outputPluginDetails(std::cout, plugin); return 0; } if (arguments.read("--formats")) { osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); for(osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) { osgDB::outputPluginDetails(std::cout,*itr); } return 0; } if (arguments.argc()<=1) { arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); return 1; } FileNameList fileNames; OrientationConverter oc; bool do_convert = false; if (arguments.read("--use-world-frame")) { oc.useWorldFrame(true); } std::string str; while (arguments.read("-O",str)) { osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options; options->setOptionString(str); osgDB::Registry::instance()->setOptions(options); } while (arguments.read("-e",ext)) { std::string libName = osgDB::Registry::instance()->createLibraryNameForExtension(ext); osgDB::Registry::instance()->loadLibrary(libName); } std::string libName; while (arguments.read("-l",libName)) { osgDB::Registry::instance()->loadLibrary(libName); } while (arguments.read("-o",str)) { osg::Vec3 from, to; if( sscanf( str.c_str(), "%f,%f,%f-%f,%f,%f", &from[0], &from[1], &from[2], &to[0], &to[1], &to[2] ) != 6 ) { float degrees; osg::Vec3 axis; // Try deg-axis format if( sscanf( str.c_str(), "%f-%f,%f,%f", °rees, &axis[0], &axis[1], &axis[2] ) != 4 ) { usage( argv[0], "Orientation argument format incorrect." ); return 1; } else { oc.setRotation( degrees, axis ); do_convert = true; } } else { oc.setRotation( from, to ); do_convert = true; } } while (arguments.read("-s",str)) { osg::Vec3 scale(0,0,0); if( sscanf( str.c_str(), "%f,%f,%f", &scale[0], &scale[1], &scale[2] ) != 3 ) { usage( argv[0], "Scale argument format incorrect." ); return 1; } oc.setScale( scale ); do_convert = true; } float simplifyPercent = 1.0; bool do_simplify = false; while ( arguments.read( "--simplify",str ) ) { float nsimp = 1.0; if( sscanf( str.c_str(), "%f", &nsimp ) != 1 ) { usage( argv[0], "Scale argument format incorrect." ); return 1; } std::cout << str << " " << nsimp << std::endl; simplifyPercent = nsimp; osg::notify( osg::INFO ) << "Simplifying with percentage: " << simplifyPercent << std::endl; do_simplify = true; } while (arguments.read("-t",str)) { osg::Vec3 trans(0,0,0); if( sscanf( str.c_str(), "%f,%f,%f", &trans[0], &trans[1], &trans[2] ) != 3 ) { usage( argv[0], "Translation argument format incorrect." ); return 1; } oc.setTranslation( trans ); do_convert = true; } FixTransparencyVisitor::FixTransparencyMode fixTransparencyMode = FixTransparencyVisitor::NO_TRANSPARANCY_FIXING; std::string fixString; while(arguments.read("--fix-transparency")) fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE; while(arguments.read("--fix-transparency-mode",fixString)) { if (fixString=="MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE; if (fixString=="MAKE_ALL_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_ALL_STATESET_OPAQUE; }; bool pruneStateSet = false; while(arguments.read("--prune-StateSet")) pruneStateSet = true; osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT; while(arguments.read("--compressed") || arguments.read("--compressed-arb")) { internalFormatMode = osg::Texture::USE_ARB_COMPRESSION; } while(arguments.read("--compressed-dxt1")) { internalFormatMode = osg::Texture::USE_S3TC_DXT1_COMPRESSION; } while(arguments.read("--compressed-dxt3")) { internalFormatMode = osg::Texture::USE_S3TC_DXT3_COMPRESSION; } while(arguments.read("--compressed-dxt5")) { internalFormatMode = osg::Texture::USE_S3TC_DXT5_COMPRESSION; } bool smooth = false; while(arguments.read("--smooth")) { smooth = true; } bool addMissingColours = false; while(arguments.read("--addMissingColours") || arguments.read("--addMissingColors")) { addMissingColours = true; } bool do_overallNormal = false; while(arguments.read("--overallNormal") || arguments.read("--overallNormal")) { do_overallNormal = true; } bool enableObjectCache = false; while(arguments.read("--enable-object-cache")) { enableObjectCache = true; } // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); // report any errors if they have occurred when parsing the program arguments. if (arguments.errors()) { arguments.writeErrorMessages(std::cout); return 1; } for(int pos=1;pos<arguments.argc();++pos) { if (!arguments.isOption(pos)) { fileNames.push_back(arguments[pos]); } } if (enableObjectCache) { if (osgDB::Registry::instance()->getOptions()==0) osgDB::Registry::instance()->setOptions(new osgDB::Options()); osgDB::Registry::instance()->getOptions()->setObjectCacheHint(osgDB::Options::CACHE_ALL); } std::string fileNameOut("converted.osg"); if (fileNames.size()>1) { fileNameOut = fileNames.back(); fileNames.pop_back(); } osg::Timer_t startTick = osg::Timer::instance()->tick(); osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(fileNames); if (root.valid()) { osg::Timer_t endTick = osg::Timer::instance()->tick(); osg::notify(osg::INFO)<<"Time to load files "<<osg::Timer::instance()->delta_m(startTick, endTick)<<" ms"<<std::endl; } if (pruneStateSet) { PruneStateSetVisitor pssv; root->accept(pssv); } if (fixTransparencyMode != FixTransparencyVisitor::NO_TRANSPARANCY_FIXING) { FixTransparencyVisitor atv(fixTransparencyMode); root->accept(atv); } if ( root.valid() ) { if (smooth) { osgUtil::SmoothingVisitor sv; root->accept(sv); } if (addMissingColours) { AddMissingColoursToGeometryVisitor av; root->accept(av); } // optimize the scene graph, remove redundant nodes and state etc. osgUtil::Optimizer optimizer; optimizer.optimize(root.get()); if( do_convert ) root = oc.convert( root.get() ); if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT) { std::string ext = osgDB::getFileExtension(fileNameOut); CompressTexturesVisitor ctv(internalFormatMode); root->accept(ctv); ctv.compress(); osgDB::ReaderWriter::Options *options = osgDB::Registry::instance()->getOptions(); if (ext!="ive" || (options && options->getOptionString().find("noTexturesInIVEFile")!=std::string::npos)) { ctv.write(osgDB::getFilePath(fileNameOut)); } } // scrub normals if ( do_overallNormal ) { DefaultNormalsGeometryVisitor dngv; root->accept( dngv ); } // apply any user-specified simplification if ( do_simplify ) { osgUtil::Simplifier simple; simple.setSmoothing( smooth ); osg::notify( osg::ALWAYS ) << " smoothing: " << smooth << std::endl; simple.setSampleRatio( simplifyPercent ); root->accept( simple ); } osgDB::ReaderWriter::WriteResult result = osgDB::Registry::instance()->writeNode(*root,fileNameOut,osgDB::Registry::instance()->getOptions()); if (result.success()) { osg::notify(osg::NOTICE)<<"Data written to '"<<fileNameOut<<"'."<< std::endl; } else if (result.message().empty()) { osg::notify(osg::NOTICE)<<"Warning: file write to '"<<fileNameOut<<"' not supported."<< std::endl; } else { osg::notify(osg::NOTICE)<<result.message()<< std::endl; } } else { osg::notify(osg::NOTICE)<<"Error no data loaded."<< std::endl; return 1; } return 0; }
int main( int argc, char **argv ) { // use an ArgumentParser object to manage the program arguments. osg::ArgumentParser arguments(&argc,argv); // set up the usage document, in case we need to print out how to use this program. arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters"); arguments.getApplicationUsage()->addCommandLineOption("--help-env","Display environmental variables available"); //arguments.getApplicationUsage()->addCommandLineOption("--formats","List supported file formats"); //arguments.getApplicationUsage()->addCommandLineOption("--plugins","List database olugins"); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { osg::setNotifyLevel(osg::NOTICE); usage( arguments.getApplicationName().c_str(), 0 ); //arguments.getApplicationUsage()->write(std::cout); return 1; } if (arguments.read("--help-env")) { arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE); return 1; } if (arguments.read("--plugins")) { osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); for(osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) { std::cout<<"Plugin "<<*itr<<std::endl; } return 0; } std::string plugin; if (arguments.read("--plugin", plugin)) { osgDB::outputPluginDetails(std::cout, plugin); return 0; } std::string ext; if (arguments.read("--format", ext)) { plugin = osgDB::Registry::instance()->createLibraryNameForExtension(ext); osgDB::outputPluginDetails(std::cout, plugin); return 0; } if (arguments.read("--formats")) { osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); for(osgDB::FileNameList::iterator itr = plugins.begin(); itr != plugins.end(); ++itr) { osgDB::outputPluginDetails(std::cout,*itr); } return 0; } if (arguments.argc()<=1) { arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); return 1; } FileNameList fileNames; OrientationConverter oc; bool do_convert = false; if (arguments.read("--use-world-frame")) { oc.useWorldFrame(true); } std::string str; while (arguments.read("-O",str)) { osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options; options->setOptionString(str); osgDB::Registry::instance()->setOptions(options); } while (arguments.read("-e",ext)) { std::string libName = osgDB::Registry::instance()->createLibraryNameForExtension(ext); osgDB::Registry::instance()->loadLibrary(libName); } std::string libName; while (arguments.read("-l",libName)) { osgDB::Registry::instance()->loadLibrary(libName); } while (arguments.read("-o",str)) { osg::Vec3 from, to; if( sscanf( str.c_str(), "%f,%f,%f-%f,%f,%f", &from[0], &from[1], &from[2], &to[0], &to[1], &to[2] ) != 6 ) { float degrees; osg::Vec3 axis; // Try deg-axis format if( sscanf( str.c_str(), "%f-%f,%f,%f", °rees, &axis[0], &axis[1], &axis[2] ) != 4 ) { usage( argv[0], "Orientation argument format incorrect." ); return 1; } else { oc.setRotation( degrees, axis ); do_convert = true; } } else { oc.setRotation( from, to ); do_convert = true; } } while (arguments.read("-s",str)) { osg::Vec3 scale(0,0,0); if( sscanf( str.c_str(), "%f,%f,%f", &scale[0], &scale[1], &scale[2] ) != 3 ) { usage( argv[0], "Scale argument format incorrect." ); return 1; } oc.setScale( scale ); do_convert = true; } float simplifyPercent = 1.0; bool do_simplify = false; while ( arguments.read( "--simplify",str ) ) { float nsimp = 1.0; if( sscanf( str.c_str(), "%f", &nsimp ) != 1 ) { usage( argv[0], "Scale argument format incorrect." ); return 1; } std::cout << str << " " << nsimp << std::endl; simplifyPercent = nsimp; osg::notify( osg::INFO ) << "Simplifying with percentage: " << simplifyPercent << std::endl; do_simplify = true; } while (arguments.read("-t",str)) { osg::Vec3 trans(0,0,0); if( sscanf( str.c_str(), "%f,%f,%f", &trans[0], &trans[1], &trans[2] ) != 3 ) { usage( argv[0], "Translation argument format incorrect." ); return 1; } oc.setTranslation( trans ); do_convert = true; } FixTransparencyVisitor::FixTransparencyMode fixTransparencyMode = FixTransparencyVisitor::NO_TRANSPARANCY_FIXING; std::string fixString; while(arguments.read("--fix-transparency")) fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE; while(arguments.read("--fix-transparency-mode",fixString)) { if (fixString=="MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE; if (fixString=="MAKE_ALL_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_ALL_STATESET_OPAQUE; }; bool pruneStateSet = false; while(arguments.read("--prune-StateSet")) pruneStateSet = true; osg::Texture::InternalFormatMode internalFormatMode = osg::Texture::USE_IMAGE_DATA_FORMAT; while(arguments.read("--compressed") || arguments.read("--compressed-arb")) { internalFormatMode = osg::Texture::USE_ARB_COMPRESSION; } while(arguments.read("--compressed-dxt1")) { internalFormatMode = osg::Texture::USE_S3TC_DXT1_COMPRESSION; } while(arguments.read("--compressed-dxt3")) { internalFormatMode = osg::Texture::USE_S3TC_DXT3_COMPRESSION; } while(arguments.read("--compressed-dxt5")) { internalFormatMode = osg::Texture::USE_S3TC_DXT5_COMPRESSION; } bool smooth = false; while(arguments.read("--smooth")) { smooth = true; } bool addMissingColours = false; while(arguments.read("--addMissingColours") || arguments.read("--addMissingColors")) { addMissingColours = true; } bool do_overallNormal = false; while(arguments.read("--overallNormal") || arguments.read("--overallNormal")) { do_overallNormal = true; } bool enableObjectCache = false; while(arguments.read("--enable-object-cache")) { enableObjectCache = true; } // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); // report any errors if they have occurred when parsing the program arguments. if (arguments.errors()) { arguments.writeErrorMessages(std::cout); return 1; } for(int pos=1;pos<arguments.argc();++pos) { if (!arguments.isOption(pos)) { fileNames.push_back(arguments[pos]); } } if (enableObjectCache) { if (osgDB::Registry::instance()->getOptions()==0) osgDB::Registry::instance()->setOptions(new osgDB::Options()); osgDB::Registry::instance()->getOptions()->setObjectCacheHint(osgDB::Options::CACHE_ALL); } std::string fileNameOut("converted.osg"); if (fileNames.size()>1) { fileNameOut = fileNames.back(); fileNames.pop_back(); } osg::Timer_t startTick = osg::Timer::instance()->tick(); osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(fileNames); if (root.valid()) { osg::Timer_t endTick = osg::Timer::instance()->tick(); osg::notify(osg::INFO)<<"Time to load files "<<osg::Timer::instance()->delta_m(startTick, endTick)<<" ms"<<std::endl; } if (pruneStateSet) { PruneStateSetVisitor pssv; root->accept(pssv); } if (fixTransparencyMode != FixTransparencyVisitor::NO_TRANSPARANCY_FIXING) { FixTransparencyVisitor atv(fixTransparencyMode); root->accept(atv); } if ( root.valid() ) { if (smooth) { osgUtil::SmoothingVisitor sv; root->accept(sv); } if (addMissingColours) { AddMissingColoursToGeometryVisitor av; root->accept(av); } auto to_lower = std::bind(&boost::to_lower_copy<std::string>,std::placeholders::_1,std::locale()); // all names to lower Utils::CommonVisitor<osg::Node> names_lower( [=](osg::Node& n)->void { n.setName(to_lower(n.getName())); }); root->accept(names_lower); // optimize the scene graph, remove rendundent nodes and state etc. osgUtil::Optimizer optimizer; FindNodeVisitor::nodeNamesList list_name; for(int i=0; i<sizeof(do_not_optimize::names)/sizeof(do_not_optimize::names[0]);++i) { list_name.push_back(do_not_optimize::names[i]); } FindNodeVisitor findNodes(list_name,FindNodeVisitor::not_exact); root->accept(findNodes); const FindNodeVisitor::nodeListType& wln_list = findNodes.getNodeList(); for(auto it = wln_list.begin(); it != wln_list.end(); ++it ) { optimizer.setPermissibleOptimizationsForObject(*it,0); } optimizer.optimize(root.get(), osgUtil::Optimizer::FLATTEN_STATIC_TRANSFORMS | osgUtil::Optimizer::REMOVE_REDUNDANT_NODES | osgUtil::Optimizer::SHARE_DUPLICATE_STATE | osgUtil::Optimizer::MERGE_GEOMETRY | osgUtil::Optimizer::MERGE_GEODES | osgUtil::Optimizer::STATIC_OBJECT_DETECTION ); boost::filesystem::path pathFileOut(fileNameOut); std::string base_file_name = pathFileOut.parent_path().string() + "/" + pathFileOut.stem().string(); cg::point_3 offset; bool res = generateBulletFile(base_file_name + ".bullet", root, offset); if (res) { osg::notify(osg::NOTICE)<<"Data written to '"<< base_file_name + ".bullet"<<"'."<< std::endl; } else { osg::notify(osg::NOTICE)<< "Error Occurred While Writing to "<< base_file_name + ".bullet"<< std::endl; } osg::Group* newroot = dynamic_cast<osg::Group*>(findFirstNode(root,"Root")); if(newroot==nullptr) { newroot = new osg::Group; newroot->setName("Root"); newroot->addChild( root ); root = newroot; } std::ofstream filelogic( base_file_name + ".stbin", std::ios_base::binary ); std::ofstream logfile ( base_file_name + std::string("_structure") + ".txt" ); heilVisitor hv(filelogic, logfile, offset); hv.apply(*root.get()); if( do_convert ) root = oc.convert( root.get() ); FIXME(Without textures useless) #if 0 const std::string name = pathFileOut.stem().string(); osgDB::FilePathList fpl_; fpl_.push_back(pathFileOut.parent_path().string() + "/"); std::string mat_file_name = osgDB::findFileInPath(name+".dae.mat.xml", /*fpl.*/fpl_,osgDB::CASE_INSENSITIVE); MaterialVisitor::namesList nl; nl.push_back("building"); nl.push_back("default"); nl.push_back("tree"); nl.push_back("ground"); nl.push_back("concrete"); nl.push_back("mountain"); nl.push_back("sea"); nl.push_back("railing"); nl.push_back("panorama"); nl.push_back("plane"); //nl.push_back("rotor"); /// �ללללללללללללל נאסךמלוםעאנטע� ט הטםאלטקוסךטי ףבתועס� MaterialVisitor mv ( nl, std::bind(&creators::createMaterial,sp::_1,sp::_2,name,sp::_3,sp::_4),creators::computeAttributes,mat::reader::read(mat_file_name)); root->accept(mv); #endif if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT) { std::string ext = osgDB::getFileExtension(fileNameOut); CompressTexturesVisitor ctv(internalFormatMode); root->accept(ctv); ctv.compress(); osgDB::ReaderWriter::Options *options = osgDB::Registry::instance()->getOptions(); if (ext!="ive" || (options && options->getOptionString().find("noTexturesInIVEFile")!=std::string::npos)) { ctv.write(osgDB::getFilePath(fileNameOut)); } } // scrub normals if ( do_overallNormal ) { DefaultNormalsGeometryVisitor dngv; root->accept( dngv ); } // apply any user-specified simplification if ( do_simplify ) { osgUtil::Simplifier simple; simple.setSmoothing( smooth ); osg::notify( osg::ALWAYS ) << " smoothing: " << smooth << std::endl; simple.setSampleRatio( simplifyPercent ); root->accept( simple ); } osgDB::ReaderWriter::WriteResult result = osgDB::Registry::instance()->writeNode(*root,fileNameOut,osgDB::Registry::instance()->getOptions()); if (result.success()) { osg::notify(osg::NOTICE)<<"Data written to '"<<fileNameOut<<"'."<< std::endl; } else if (result.message().empty()) { osg::notify(osg::NOTICE)<<"Warning: file write to '"<<fileNameOut<<"' not supported."<< std::endl; } else { osg::notify(osg::NOTICE)<<result.message()<< std::endl; } } else {
int main() { PairWiseMove move; Dimension atvsize(1,1); Dimension coptersize(1,1); Dimension searchSize(2,2); VirtualQuadCopter copter(coptersize,searchSize,4,4); VirtualATV atv(atvsize, 0, 0); Map mapp; Route atvRoute; //atvRoute.push_back(WayPoint(1, 1)); Route * result = move.generatePairRoute(atvRoute, atv, copter, mapp )->first; bool error = false; if(result->getSize() == 1){ //Quad must move te atv if(!(result->getWaypoint(0)->x == 0 && result->getWaypoint(0)->y == 0)){ error = true; std::cout << "Quad must move to atv waypoint ERROR" << std::endl; } std::cout << "Quad must move te atv SUCCES" << std::endl; } else{ std::cout << "Quad must move te atv size ERROR" << std::endl; } copter = VirtualQuadCopter(coptersize,searchSize,0,0); atv = VirtualATV(atvsize, 0, 0); atvRoute.clearRoute(); atvRoute.pushWayPoint( new WayPoint(1, 1)); result = move.generatePairRoute(atvRoute, atv, copter, mapp)->first; if(!(result->getSize() == 0)){ //Atv is just in range of quadsight error = true; std::cout << "Atv is just in range of quadsight ERROR"<< std::endl; }else{ std::cout << "Atv is just in range of quadsight SUCCES"<< std::endl; } atvRoute.clearRoute(); atvRoute.pushWayPoint( new WayPoint(2, 2)); result = move.generatePairRoute(atvRoute, atv, copter, mapp)->first; if(result->getSize() == 1){ //Atv is just out range of quadsight if(!(result->getWaypoint(0)->x == 2 && result->getWaypoint(0)->y == 2)){ error = true; std::cout << "Atv is just out range of quadsight waypoint ERROR"<< std::endl; } std::cout << "Atv is just out range of quadsight SUCCES" << std::endl; } else{ std::cout << "Atv is just out range of quadsight size ERROR"<< std::endl; } atvRoute.clearRoute(); result = move.generatePairRoute(atvRoute, atv, copter, mapp)->first; if(!result->getSize() == 0){//Empty atv route returns... error = true; std::cout << "Empty atv route returns empty pair route ERROR"<< std::endl; }else{ std::cout << "Empty atv route returns empty pair route SUCCES"<< std::endl; } copter.goTo(1, 4); result = move.generatePairRoute(atvRoute, atv, copter, mapp)->first; if(!result->getSize() == 1){//Empty atv route returns... error = true; std::cout << "Empty atv route returns sync waypoint size ERROR"<< std::endl; } else{ if(result->getWaypoint(0)->x == 0 && result->getWaypoint(0)->y == 0){ std::cout << "Empty atv route returns sync waypoint SUCCES"<< std::endl; } else{ error = true; std::cout << "Empty atv route returns sync waypoint waypoint ERROR"<< std::endl; } } copter.goTo(0,0); atvRoute.pushWayPoint(new WayPoint(1, 2)); atvRoute.pushWayPoint(new WayPoint(2, 3)); atvRoute.pushWayPoint(new WayPoint(4, 2)); atvRoute.pushWayPoint(new WayPoint(5, 3)); atvRoute.pushWayPoint(new WayPoint(-1, -1)); result = move.generatePairRoute(atvRoute, atv, copter, mapp)->first; if(result->getSize() == 3){//Longer route std::cout << "Long route size: Good, SUCCES" << std::endl; if(!(result->getWaypoint(0)->x == 1 && result->getWaypoint(0)->y == 2)){ error = true; std::cout << " Point 1,2 ERROR" << std::endl; } else{ std::cout << " Point 1,2 SUCCES" << std::endl; } if(!(result->getWaypoint(1)->x == 4 && result->getWaypoint(1)->y == 2)){ error = true; std::cout << " Point 4,2 ERROR" << std::endl; } else{ std::cout << " Point 4,2 SUCCES" << std::endl; } if(!(result->getWaypoint(2)->x == -1 && result->getWaypoint(2)->y == -1)){ error = true; std::cout << " Point -1,-1 ERROR" << std::endl; } else{ std::cout << " Point -1,-1 SUCCES" << std::endl; } } else{ error = true; std::cout << "Long route size: fault, ERROR" << std::endl; } return error; }