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

Function getIndexFromPosition

grid_map_core/src/GridMapMath.cpp:129–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129bool getIndexFromPosition(Index& index,
130 const Position& position,
131 const Length& mapLength,
132 const Position& mapPosition,
133 const double& resolution,
134 const Size& bufferSize,
135 const Index& bufferStartIndex)
136{
137 Vector offset;
138 getVectorToOrigin(offset, mapLength);
139 Vector indexVector = ((position - offset - mapPosition).array() / resolution).matrix();
140 index = getIndexFromIndexVector(indexVector, bufferSize, bufferStartIndex);
141 return checkIfPositionWithinMap(position, mapLength, mapPosition) && checkIfIndexInRange(index, bufferSize);
142}
143
144bool checkIfPositionWithinMap(const Position& position,
145 const Length& mapLength,

Callers 6

TESTFunction · 0.85
getSubmapInformationFunction · 0.85
getIndexMethod · 0.85
findSubmapParametersMethod · 0.85
findSubmapParametersMethod · 0.85
findSubmapParametersMethod · 0.85

Calls 4

getVectorToOriginFunction · 0.85
getIndexFromIndexVectorFunction · 0.85
checkIfPositionWithinMapFunction · 0.85
checkIfIndexInRangeFunction · 0.85

Tested by 1

TESTFunction · 0.68