24 throw std::invalid_argument(
"Failed to construct LineIterator.");
80 Vector direction = (end - start).normalized();
81 while (!gridMap.
getIndex(newStart, index)) {
82 newStart += (gridMap.
getResolution() - std::numeric_limits<double>::epsilon()) * direction;
83 if ((end - newStart).norm() < gridMap.
getResolution() - std::numeric_limits<double>::epsilon()) {
97 const Size delta = (unwrappedEnd - unwrappedStart).abs();
99 if (unwrappedEnd.x() >= unwrappedStart.x()) {
109 if (unwrappedEnd.y() >= unwrappedStart.y()) {
119 if (delta.x() >= delta.y()) {
bool operator!=(const LineIterator &other) const
unsigned int iCell_
Current cell number.
unsigned int nCells_
Number of cells in the line.
const Index & getStartIndex() const
Index getIndexFromBufferIndex(const Index &bufferIndex, const Size &bufferSize, const Index &bufferStartIndex)
Index end_
Ending index of the line.
const Size & getSize() const
LineIterator(const grid_map::GridMap &gridMap, const Position &start, const Position &end)
double getResolution() const
Length mapLength_
Map information needed to get position from iterator.
static bool getIndexLimitedToMapRange(const grid_map::GridMap &gridMap, const Position &start, const Position &end, Index &index)
const Index & operator*() const
LineIterator & operator++()
Size increment1_
Helper variables for Bresenham Line Drawing algorithm.
Index start_
Starting index of the line.
Index getBufferIndexFromIndex(const Index &index, const Size &bufferSize, const Index &bufferStartIndex)
bool getIndex(const Position &position, Index &index) const
bool getPosition(const Index &index, Position &position) const
bool initialize(const grid_map::GridMap &gridMap, const Index &start, const Index &end)
void initializeIterationParameters()
const Length & getLength() const
Index index_
Current index.