MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / runGridMapIteratorVersion2

Function runGridMapIteratorVersion2

grid_map_demos/src/iterator_benchmark.cpp:34–44  ·  view source on GitHub ↗

! * Improved efficiency by storing direct access to data layers. */

Source from the content-addressed store, hash-verified

32 * Improved efficiency by storing direct access to data layers.
33 */
34void runGridMapIteratorVersion2(GridMap& map, const string& layer_from, const string& layer_to)
35{
36 const auto& data_from = map[layer_from];
37 auto& data_to = map[layer_to];
38 for (GridMapIterator iterator(map); !iterator.isPastEnd(); ++iterator) {
39 const Index index(*iterator);
40 const float value_from = data_from(index(0), index(1));
41 float& value_to = data_to(index(0), index(1));
42 value_to = value_to > value_from ? value_to : value_from;
43 }
44}
45
46/*!
47 * Improved efficiency by using linear index.

Callers 1

mainFunction · 0.85

Calls 1

isPastEndMethod · 0.45

Tested by

no test coverage detected