console_view.h
Go to the documentation of this file.
1 #ifndef SLAM_CTOR_UTILS_CONSOLE_VIEW_H_INCLUDED
2 #define SLAM_CTOR_UTILS_CONSOLE_VIEW_H_INCLUDED
3 
4 void show_grid_map(const GridMap &map, const Point2D &center,
5  double d_x_left, double d_x_right,
6  double d_y_up, double d_y_down) {
7  auto center_cell = map.world_to_cell(center);
8 
9  auto delta_c = DiscretePoint2D{0, 0};
10  auto top_left = map.world_to_cell(d_x_left, d_y_up);
11  auto bot_right = map.world_to_cell(d_x_right, d_y_down);
12  for (delta_c.y = top_left.y; -bot_right.y <= delta_c.y; --delta_c.y) {
13  for (delta_c.x = -top_left.x; delta_c.x <= bot_right.x; ++delta_c.x) {
14  auto coord = center_cell + delta_c;
15  auto cell_occ = map[coord];
16  char map_cell_content;
17  if (center_cell == coord) {
18  map_cell_content = 'C';
19  } else if (0.75 < cell_occ) {
20  map_cell_content = '#';
21  } else if (cell_occ < 0.25) {
22  map_cell_content = '.';
23  } else {
24  map_cell_content = '~';
25  }
26  std::cout << map_cell_content;
27  }
28  std::cout << std::endl;
29  }
30 }
31 
32 void show_grid_map(const GridMap &map, const Point2D &center,
33  double d_x, double d_y) {
34  show_grid_map(map, center, d_x, d_x, d_y, d_y);
35 }
36 
37 #endif
Coord world_to_cell(const Point2D &pt) const
void show_grid_map(const GridMap &map, const Point2D &center, double d_x_left, double d_x_right, double d_y_up, double d_y_down)
Definition: console_view.h:4


slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25