Add function for setting flag in one map cell.
for(x=x_0-bitmap_straight[angle].x_min; x<=x_0+bitmap_straight[angle].x_max;x++){
for(y=y_0-bitmap_straight[angle].y_min; y<=y_0+bitmap_straight[angle].y_max;y++){
+
+ ShmapSetCellFlag(x,y,MAP_FLAG_PATH_SHAPE);
+
if (!ShmapIsFreeCell(x,y)){ //1 no obstacle,-1 no in map, 0 otherwise
return false;
}
return true;
}
+
+ ShmapSetCellFlag(x,x+q,MAP_FLAG_PATH_SHAPE);
+
// int get_angle_between_cells(int x_0, int y_0, int x_1, int y_1){
//
// double angle=0;
return 1;
}
+/**
+ * @brief Set flag in the map cell
+ * @param x Coordonate X (int) of the cell
+ * @param y Coordonate Y (int) of the cell
+ * @param set_flags Map cell falgs
+ *
+ */
+int ShmapSetCellFlag(int x, int y, map_cell_flag_t set_flags)
+{
+ if (!ShmapIsCellInMap(x, y)){
+ return 0;
+ }
+
+ map->cells[y][x].flags |= set_flags;
+
+ return 1;
+}
+
+/** @} */
+
/**
* @brief Creates an obstacle in the map
* @param x1 Coordonate X (in m) of the first point
* not during runtime obstacle avoidance. */
#define MAP_FLAG_PLAN_MARGIN 128
#define MAP_FLAG_INVALIDATE_WALL 256 /**< Area, where the wall should be forgotten */
+#define MAP_FLAG_PATH_SHAPE 512
/** @}*/
/** @name Shared Memory macros */
int ShmapSetRectangleFlag(double x1, double y1, double x2, double y2, map_cell_flag_t set_flags, map_cell_flag_t clear_flags);
int ShmapSetCircleFlag(double xs, double ys, double r, map_cell_flag_t set_flags, map_cell_flag_t clear_flags);
+int ShmapSetCellFlag(int x, int y, map_cell_flag_t set_flags);
+
#ifdef __cplusplus
}
#endif
char c;
if (ShmapIsFreeCell(x, y)) {
c = '.';
+ if (map->cells[y][x].flags & MAP_FLAG_PATH_SHAPE) {
+ c = 's';
+ }
if (map->cells[y][x].flags & MAP_FLAG_PATH) {
c = 'p';
}
+
} else
c = '#';
putchar(c);