1 #ifndef CommandGenerateCompletePath_h
2 #define CommandGenerateCompletePath_h
14 namespace fs = std::filesystem;
15 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;
22 inline static const CommandTypeId COMMAND_ID =
"GENERATE_COMPLETE_PATH_FOR_SCENE";
34 return entityReflexion;
38 std::unique_ptr<CscLogger>
logger;
42 bool areaDefined =
false;
45 float tileSizeCm = 100.0f;
46 const float BEST_PATH_POINTS_HEIGHT_CM = 10;
48 vector<CscPoint3dOriented *> bestPath;
50 int tilesPerColumnCount = 0;
55 int inaccessibleTilesCount = 0;
56 int visitedOnceTilesCount = 0;
57 int allVisitedTilesCount = 0;
59 void computeBaseTile();
69 vector<int> visitsIndices;
73 bool accessible) :indexX(indexX), indexY(indexY),accessible(accessible) {
83 const int remoteChunkIndexInColumn;
85 const int tileIndexInRemoteChunk;
87 bool disabled =
false;
89 ColumnChunkCrossroad(
int remoteChunkIndexInColumn,
91 int tileIndexInRemoteChunk,
93 remoteChunkIndexInColumn(remoteChunkIndexInColumn), y(y),tileIndexInRemoteChunk(tileIndexInRemoteChunk), left(left) {
102 vector<Tile *> tiles;
107 vector<ColumnChunkCrossroad *> pivotsLeft;
108 vector<ColumnChunkCrossroad *> pivotsRight;
110 bool allTilesVisited() {
111 for (Tile * tile : tiles) {
112 if (!tile->visited) {
128 Image* mapImage =
nullptr;
130 ColumnChunkCrossroad * lastCrossRoad =
nullptr;
131 vector<vector<ColumnChunk>> columns;
132 vector<vector<Tile *>> tiles;
133 void processChunk(
int ix, ColumnChunk & current,
int currentTileIndexInChunk);
135 pair<int, int> lastTile = make_pair(-1, -1);
136 void addToBestPath(
int tileX,
int tileY);
138 void initializeDimensions();
139 void generateTiles();
140 bool computeAccessibleTiles(
float x2D,
float y2D,
float height);
141 bool computeAccessibleTilesCartography(vector<CscPoint3d*> *placeVertices);
142 bool computeAccessibleTilesPlace(vector<const CscPoint3d*> *placeVertices);
145 void addPathToTargetToBestPath(
int tileX,
int currentTileY,
int targetTileY);
146 void enterCrossroad(
int currentColumnIndex, ColumnChunkCrossroad * crossroad);