@@ -125,15 +125,16 @@ void TestNode::validatePointInflation(
125
125
bool * seen = new bool [costmap->getSizeInCellsX () * costmap->getSizeInCellsY ()];
126
126
memset (seen, false , costmap->getSizeInCellsX () * costmap->getSizeInCellsY () * sizeof (bool ));
127
127
std::map<double , std::vector<CellData>> m;
128
- CellData initial (costmap-> getIndex (mx, my), mx, my, mx, my);
128
+ CellData initial (mx, my, mx, my);
129
129
m[0 ].push_back (initial);
130
130
for (std::map<double , std::vector<CellData>>::iterator bin = m.begin ();
131
131
bin != m.end (); ++bin)
132
132
{
133
133
for (unsigned int i = 0 ; i < bin->second .size (); ++i) {
134
134
const CellData cell = bin->second [i];
135
- if (!seen[cell.index_ ]) {
136
- seen[cell.index_ ] = true ;
135
+ const auto index = costmap->getIndex (cell.x_ , cell.y_ );
136
+ if (!seen[index ]) {
137
+ seen[index ] = true ;
137
138
unsigned int dx = (cell.x_ > cell.src_x_ ) ? cell.x_ - cell.src_x_ : cell.src_x_ - cell.x_ ;
138
139
unsigned int dy = (cell.y_ > cell.src_y_ ) ? cell.y_ - cell.src_y_ : cell.src_y_ - cell.y_ ;
139
140
double dist = std::hypot (dx, dy);
@@ -152,23 +153,19 @@ void TestNode::validatePointInflation(
152
153
}
153
154
154
155
if (cell.x_ > 0 ) {
155
- CellData data (costmap->getIndex (cell.x_ - 1 , cell.y_ ),
156
- cell.x_ - 1 , cell.y_ , cell.src_x_ , cell.src_y_ );
156
+ CellData data (cell.x_ - 1 , cell.y_ , cell.src_x_ , cell.src_y_ );
157
157
m[dist].push_back (data);
158
158
}
159
159
if (cell.y_ > 0 ) {
160
- CellData data (costmap->getIndex (cell.x_ , cell.y_ - 1 ),
161
- cell.x_ , cell.y_ - 1 , cell.src_x_ , cell.src_y_ );
160
+ CellData data (cell.x_ , cell.y_ - 1 , cell.src_x_ , cell.src_y_ );
162
161
m[dist].push_back (data);
163
162
}
164
163
if (cell.x_ < costmap->getSizeInCellsX () - 1 ) {
165
- CellData data (costmap->getIndex (cell.x_ + 1 , cell.y_ ),
166
- cell.x_ + 1 , cell.y_ , cell.src_x_ , cell.src_y_ );
164
+ CellData data (cell.x_ + 1 , cell.y_ , cell.src_x_ , cell.src_y_ );
167
165
m[dist].push_back (data);
168
166
}
169
167
if (cell.y_ < costmap->getSizeInCellsY () - 1 ) {
170
- CellData data (costmap->getIndex (cell.x_ , cell.y_ + 1 ),
171
- cell.x_ , cell.y_ + 1 , cell.src_x_ , cell.src_y_ );
168
+ CellData data (cell.x_ , cell.y_ + 1 , cell.src_x_ , cell.src_y_ );
172
169
m[dist].push_back (data);
173
170
}
174
171
}
0 commit comments