1 #ifndef CommandGenerateCompletePath_h
2 #define CommandGenerateCompletePath_h
8 #include <opencv2/opencv.hpp>
16 namespace fs = std::filesystem;
17 using std::ceil, std::map, std::pair, std::make_pair, std::max, std::floor, std::numeric_limits, std::optional, std::array, std::string, std::vector, std::unique_ptr;
24 inline static const CommandTypeId COMMAND_ID =
"GENERATE_COMPLETE_PATH_FOR_SCENE";
36 return entityReflexion;
40 std::unique_ptr<CscLogger>
logger;
44 bool areaDefined =
false;
47 float tileSizeCm = 100.0f;
48 const float BEST_PATH_POINTS_HEIGHT_CM = 10;
50 vector<CscPoint3dOriented *> bestPath;
52 int tilesPerColumnCount = 0;
57 int inaccessibleTilesCount = 0;
58 int visitedOnceTilesCount = 0;
59 int allVisitedTilesCount = 0;
61 void computeBaseTile();
71 vector<int> visitsIndices;
75 bool accessible) :indexX(indexX), indexY(indexY),accessible(accessible) {
85 const int remoteChunkIndexInColumn;
87 const int tileIndexInRemoteChunk;
89 bool disabled =
false;
91 ColumnChunkCrossroad(
int remoteChunkIndexInColumn,
93 int tileIndexInRemoteChunk,
95 remoteChunkIndexInColumn(remoteChunkIndexInColumn), y(y),tileIndexInRemoteChunk(tileIndexInRemoteChunk), left(left) {
104 vector<Tile *> tiles;
109 vector<ColumnChunkCrossroad *> pivotsLeft;
110 vector<ColumnChunkCrossroad *> pivotsRight;
112 bool allTilesVisited() {
113 for (Tile * tile : tiles) {
114 if (!tile->visited) {
129 Image* mapImage =
nullptr;
131 ColumnChunkCrossroad * lastCrossRoad =
nullptr;
132 vector<vector<ColumnChunk>> columns;
133 vector<vector<Tile *>> tiles;
134 void processChunk(
int ix, ColumnChunk & current,
int currentTileIndexInChunk);
136 pair<int, int> lastTile = make_pair(-1, -1);
137 void addToBestPath(
int tileX,
int tileY);
139 void initializeDimensions();
140 void generateTiles();
141 bool computeAccessibleTiles(
float x2D,
float y2D,
float height);
142 bool computeAccessibleTilesCartography(vector<CscPoint3d*> *placeVertices);
143 bool computeAccessibleTilesPlace(vector<const CscPoint3d*> *placeVertices);
146 void addPathToTargetToBestPath(
int tileX,
int currentTileY,
int targetTileY);
147 void enterCrossroad(
int currentColumnIndex, ColumnChunkCrossroad * crossroad);