MCPcopy Create free account
hub / github.com/OctoMap/octomap / initializeEmpty

Method initializeEmpty

dynamicEDT3D/src/dynamicEDT3D.cpp:139–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void DynamicEDT3D::initializeEmpty(int _sizeX, int _sizeY, int _sizeZ, bool initGridMap) {
140 sizeX = _sizeX;
141 sizeY = _sizeY;
142 sizeZ = _sizeZ;
143
144 sizeXm1 = sizeX-1;
145 sizeYm1 = sizeY-1;
146 sizeZm1 = sizeZ-1;
147
148 if (data) {
149 for (int x=0; x<sizeX; x++){
150 for (int y=0; y<sizeY; y++)
151 delete[] data[x][y];
152
153 delete[] data[x];
154 }
155 delete[] data;
156 }
157
158 data = new dataCell**[sizeX];
159 for (int x=0; x<sizeX; x++){
160 data[x] = new dataCell*[sizeY];
161 for(int y=0; y<sizeY; y++)
162 data[x][y] = new dataCell[sizeZ];
163 }
164
165 if (initGridMap) {
166 if (gridMap) {
167 for (int x=0; x<sizeX; x++){
168 for (int y=0; y<sizeY; y++)
169 delete[] gridMap[x][y];
170
171 delete[] gridMap[x];
172 }
173 delete[] gridMap;
174 }
175
176 gridMap = new bool**[sizeX];
177 for (int x=0; x<sizeX; x++){
178 gridMap[x] = new bool*[sizeY];
179 for (int y=0; y<sizeY; y++)
180 gridMap[x][y] = new bool[sizeZ];
181 }
182 }
183
184 dataCell c;
185 c.dist = maxDist;
186 c.sqdist = maxDist_squared;
187 c.obstX = invalidObstData;
188 c.obstY = invalidObstData;
189 c.obstZ = invalidObstData;
190 c.queueing = fwNotQueued;
191 c.needsRaise = false;
192
193 for (int x=0; x<sizeX; x++){
194 for (int y=0; y<sizeY; y++){
195 for (int z=0; z<sizeZ; z++){
196 data[x][y][z] = c;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected