Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Faster polygon iterator? #213
Comments
|
The provided iterator would call function is_Inside for each cell to judge if it is out of range. however, is_inside has O(n^2) complexity, which means the polygon iterator has O(n^3) complexity. |
Is there a way to run the polygon iterator faster?
My grid_map has a size of 200x200 with resolution of 0.25, which is quite big (640.000 cells) and a even bigger polygon which intersects the gird_map. Around about 50.000 cells inside the polygon of the grid_map (globalMap) then need to be set to an value, which requires often up to 3 seconds...
for (grid_map::PolygonIterator iterator(globalMap, polygon); !iterator.isPastEnd(); ++iterator) {
globalMap.at("test", *iterator) = 0.0;
}
//Also tried this way, which needs same computation time:
auto& data_to = globalMap["test"];
for (grid_map::PolygonIterator iterator(globalMap, polygon); !iterator.isPastEnd(); ++iterator) {
float& value_to = data_to( (*iterator)[0] , (*iterator)[1] );
value_to = 0.0;
}
Any suggestions? Thanks in advance.