43 #define FOR_EACH_NEIGHBOR_WITH_CHECK(function, p, ...) \ 54 if(z<sizeZm1) function(x, y, zp1, ##__VA_ARGS__);\ 55 if(z>0) function(x, y, zm1, ##__VA_ARGS__);\ 58 function(x, yp1, z, ##__VA_ARGS__);\ 59 if(z<sizeZm1) function(x, yp1, zp1, ##__VA_ARGS__);\ 60 if(z>0) function(x, yp1, zm1, ##__VA_ARGS__);\ 64 function(x, ym1, z, ##__VA_ARGS__);\ 65 if(z<sizeZm1) function(x, ym1, zp1, ##__VA_ARGS__);\ 66 if(z>0) function(x, ym1, zm1, ##__VA_ARGS__);\ 71 function(xp1, y, z, ##__VA_ARGS__);\ 72 if(z<sizeZm1) function(xp1, y, zp1, ##__VA_ARGS__);\ 73 if(z>0) function(xp1, y, zm1, ##__VA_ARGS__);\ 76 function(xp1, yp1, z, ##__VA_ARGS__);\ 77 if(z<sizeZm1) function(xp1, yp1, zp1, ##__VA_ARGS__);\ 78 if(z>0) function(xp1, yp1, zm1, ##__VA_ARGS__);\ 82 function(xp1, ym1, z, ##__VA_ARGS__);\ 83 if(z<sizeZm1) function(xp1, ym1, zp1, ##__VA_ARGS__);\ 84 if(z>0) function(xp1, ym1, zm1, ##__VA_ARGS__);\ 89 function(xm1, y, z, ##__VA_ARGS__);\ 90 if(z<sizeZm1) function(xm1, y, zp1, ##__VA_ARGS__);\ 91 if(z>0) function(xm1, y, zm1, ##__VA_ARGS__);\ 94 function(xm1, yp1, z, ##__VA_ARGS__);\ 95 if(z<sizeZm1) function(xm1, yp1, zp1, ##__VA_ARGS__);\ 96 if(z>0) function(xm1, yp1, zm1, ##__VA_ARGS__);\ 100 function(xm1, ym1, z, ##__VA_ARGS__);\ 101 if(z<sizeZm1) function(xm1, ym1, zp1, ##__VA_ARGS__);\ 102 if(z>0) function(xm1, ym1, zm1, ##__VA_ARGS__);\ 119 for (
int x=0; x<
sizeX; x++){
120 for (
int y=0; y<
sizeY; y++)
129 for (
int x=0; x<
sizeX; x++){
130 for (
int y=0; y<
sizeY; y++)
149 for (
int x=0; x<
sizeX; x++){
150 for (
int y=0; y<
sizeY; y++)
159 for (
int x=0; x<
sizeX; x++){
161 for(
int y=0; y<
sizeY; y++)
167 for (
int x=0; x<
sizeX; x++){
168 for (
int y=0; y<
sizeY; y++)
177 for (
int x=0; x<
sizeX; x++){
179 for (
int y=0; y<
sizeY; y++)
193 for (
int x=0; x<
sizeX; x++){
194 for (
int y=0; y<
sizeY; y++){
195 for (
int z=0; z<
sizeZ; z++){
202 for (
int x=0; x<
sizeX; x++)
203 for (
int y=0; y<
sizeY; y++)
204 for (
int z=0; z<
sizeZ; z++)
213 for (
int x=0; x<
sizeX; x++) {
214 for (
int y=0; y<
sizeY; y++) {
215 for (
int z=0; z<
sizeZ; z++) {
220 bool isSurrounded =
true;
221 for (
int dx=-1; dx<=1; dx++) {
223 if (nx<0 || nx>sizeX-1)
continue;
224 for (
int dy=-1; dy<=1; dy++) {
226 if (ny<0 || ny>sizeY-1)
continue;
227 for (
int dz=-1; dz<=1; dz++) {
228 if (dx==0 && dy==0 && dz==0)
continue;
230 if (nz<0 || nz>sizeZ-1)
continue;
233 isSurrounded =
false;
302 for (
unsigned int i=0; i<points.size(); i++) {
374 data[nx][ny][nz] = nc;
379 data[nx][ny][nz] = nc;
418 int dpx = (x - c.
obstX);
419 int dpy = (y - c.
obstY);
420 int dpz = (z - c.
obstZ);
483 int distx = nx-c.
obstX;
484 int disty = ny-c.
obstY;
485 int distz = nz-c.
obstZ;
486 int newSqDistance = distx*distx + disty*disty + distz*distz;
489 bool overwrite = (newSqDistance < nc.
sqdist);
490 if(!overwrite && newSqDistance==nc.
sqdist) {
508 if (updateRealDist) {
509 nc.
dist = sqrt((
double) newSqDistance);
511 nc.
sqdist = newSqDistance;
516 data[nx][ny][nz] = nc;
522 if( (x>=0) && (x<
sizeX) && (y>=0) && (y<
sizeY) && (z>=0) && (z<
sizeZ)){
529 if( (x>=0) && (x<
sizeX) && (y>=0) && (y<
sizeY) && (z>=0) && (z<
sizeZ)){
537 if( (x>=0) && (x<
sizeX) && (y>=0) && (y<
sizeY) && (z>=0) && (z<
sizeZ)){
546 for (
unsigned int i=0; i<
addList.size(); i++) {
554 if (updateRealDist) c.
dist = 0;
566 for (
unsigned int i=0; i<
removeList.size(); i++) {
void initializeMap(int _sizeX, int _sizeY, int sizeZ, bool ***_gridMap)
Initialization with a given binary map (false==free, true==occupied)
void clearCell(int x, int y, int z)
remove an obstacle at the specified cell coordinate
void setObstacle(int x, int y, int z)
static int distanceInCellsValue_Error
distance value returned when requesting distance in cell units for a cell outside the map ...
std::vector< INTPOINT3D > removeList
void raiseCell(INTPOINT3D &p, dataCell &c, bool updateRealDist)
float getDistance(int x, int y, int z) const
returns the obstacle distance at the specified location
void occupyCell(int x, int y, int z)
add an obstacle at the specified cell coordinate
std::vector< INTPOINT3D > lastObstacles
void push(int prio, T t)
push an element
bool empty()
Checks whether the Queue is empty.
void propagateCell(INTPOINT3D &p, dataCell &c, bool updateRealDist)
BucketPrioQueue< INTPOINT3D > open
void exchangeObstacles(std::vector< INTPOINT3D > newObstacles)
remove old dynamic obstacles and add the new ones
void initializeEmpty(int _sizeX, int _sizeY, int sizeZ, bool initGridMap=true)
Initialization with an empty map.
void commitAndColorize(bool updateRealDist=true)
std::vector< INTPOINT3D > addList
static float distanceValue_Error
distance value returned when requesting distance for a cell outside the map
void inspectCellRaise(int &nx, int &ny, int &nz, bool updateRealDist)
int getSQCellDistance(int x, int y, int z) const
returns the squared obstacle distance in cell units at the specified location
T pop()
return and pop the element with the lowest squared distance */
bool isOccupied(int x, int y, int z) const
checks whether the specficied location is occupied
virtual void update(bool updateRealDist=true)
update distance map to reflect the changes
void removeObstacle(int x, int y, int z)
INTPOINT3D getClosestObstacle(int x, int y, int z) const
gets the closest occupied cell for that location
#define FOR_EACH_NEIGHBOR_WITH_CHECK(function, p,...)
DynamicEDT3D(int _maxdist_squared)
void inspectCellPropagate(int &nx, int &ny, int &nz, dataCell &c, bool updateRealDist)