46 int sizeX, sizeY, sizeZ;
52 map =
new bool**[sizeX];
53 for(
int x=0; x<sizeX; x++){
54 map[x] =
new bool*[sizeY];
55 for(
int y=0; y<sizeY; y++){
56 map[x][y] =
new bool[sizeZ];
57 for(
int z=0; z<sizeZ; z++){
58 if(x<2 || x > sizeX-3 || y < 2 || y > sizeY-3 || z<2 || z > sizeZ-3)
70 int maxDistInCells = 20;
79 for (
int frame=1; frame<=10; frame++) {
80 std::cout<<
"\n\nthis is frame #"<<frame<<std::endl;
81 std::vector<IntPoint3D> newObstacles;
82 for (
int i=0; i<numPoints; i++) {
83 double x = 2+rand()/(double)RAND_MAX*(sizeX-4);
84 double y = 2+rand()/(double)RAND_MAX*(sizeY-4);
85 double z = 2+rand()/(double)RAND_MAX*(sizeZ-4);
98 std::cout<<
"distance at 30,67,33: "<< dist <<
" squared: "<< distSquared << std::endl;
99 if(distSquared == maxDistInCells*maxDistInCells)
100 std::cout<<
"we hit a cell with d = dmax, distance value is clamped."<<std::endl;
105 std::cout<<
"we hit a cell with d = dmax, no information about closest occupied cell."<<std::endl;
107 std::cout<<
"closest occupied cell to 30,67,33: "<< closest.
x<<
","<<closest.
y<<
","<<closest.
z<<std::endl;
112 std::cout<<
"\n\nthis is the last frame"<<std::endl;
115 std::vector<IntPoint3D> empty;
123 std::cout<<
"distance at 30,67,33: "<< dist <<
" squared: "<< distSquared << std::endl;
124 if(distSquared == maxDistInCells*maxDistInCells)
125 std::cout<<
"we hit a cell with d = dmax, distance value is clamped."<<std::endl;
130 std::cout<<
"we hit a cell with d = dmax, no information about closest occupied cell."<<std::endl;
132 std::cout<<
"closest occupied cell to 30,67,33: "<< closest.
x<<
","<<closest.
y<<
","<<closest.
z<<std::endl;
void initializeMap(int _sizeX, int _sizeY, int sizeZ, bool ***_gridMap)
Initialization with a given binary map (false==free, true==occupied)
float getDistance(int x, int y, int z) const
returns the obstacle distance at the specified location
void exchangeObstacles(std::vector< INTPOINT3D > newObstacles)
remove old dynamic obstacles and add the new ones
A DynamicEDT3D object computes and updates a 3D distance map.
int getSQCellDistance(int x, int y, int z) const
returns the squared obstacle distance in cell units at the specified location
virtual void update(bool updateRealDist=true)
update distance map to reflect the changes
INTPOINT3D getClosestObstacle(int x, int y, int z) const
gets the closest occupied cell for that location