test_dfs.cpp
Go to the documentation of this file.
00001 
00039 #include <iostream>
00040 #include <string>
00041 
00042 #include <bwi_mapper/voronoi_approximator.h>
00043 
00044 int main(int argc, char** argv) {
00045 
00046   nav_msgs::OccupancyGrid grid;
00047   grid.info.height = 5;
00048   grid.info.width = 5;
00049   grid.data.resize(25);
00050   for (int i = 0; i < 5; ++i) {
00051     for (int j = 0; j < 5; ++j) {
00052       grid.data[5*j + i] = 0;
00053     }
00054   }
00055 
00056   grid.data[5*1 + 1] = 100;
00057   grid.data[5*2 + 1] = 100;
00058   grid.data[5*3 + 1] = 100;
00059 
00060   grid.data[5*1 + 3] = 100;
00061   grid.data[5*2 + 3] = 100;
00062   grid.data[5*3 + 3] = 100;
00063 
00064   bwi_mapper::DirectedDFS dfs(grid);
00065   bwi_mapper::Point2d p1, p2;
00066   p1.x = 1, p1.y = 1;
00067   p2.x = 1, p2.y = 3;
00068   std::cout << dfs.searchForPath(p1, p2, 5) << std::endl; // 1
00069   p2.x = 3, p2.y = 3;
00070   std::cout << dfs.searchForPath(p1, p2, 5) << std::endl; // 0
00071 
00072   grid.data[5*4 + 2] = 100;
00073   std::cout << dfs.searchForPath(p1, p2, 4) << std::endl; // 1
00074   std::cout << dfs.searchForPath(p1, p2, 3) << std::endl; // 0
00075 
00076   return 0;
00077 }
00078 
00079 


bwi_mapper
Author(s): Piyush Khandelwal
autogenerated on Thu Jun 6 2019 17:57:21