Class LineIterator

Class Documentation

class LineIterator

Iterator class to iterate over a line in the map. Based on Bresenham Line Drawing algorithm.

Public Functions

LineIterator(const grid_map::GridMap &gridMap, const Position &start, const Position &end)

Constructor.

Parameters:
  • gridMap – the grid map to iterate on.

  • start – the starting point of the line.

  • end – the ending point of the line.

Throws:

std::invalid_argument – if start and end impose an ill conditioned line iteration.

LineIterator(const grid_map::GridMap &gridMap, const Index &start, const Index &end)

Constructor.

Parameters:
  • gridMap – the grid map to iterate on.

  • start – the starting index of the line.

  • end – the ending index of the line.

LineIterator &operator=(const LineIterator &other)

Assignment operator.

Parameters:

iterator – the iterator to copy data from.

Returns:

a reference to *this.

bool operator!=(const LineIterator &other) const

Compare to another iterator.

Returns:

whether the current iterator points to a different address than the other one.

const Index &operator*() const

Dereference the iterator with const.

Returns:

the value to which the iterator is pointing.

LineIterator &operator++()

Increase the iterator to the next element.

Returns:

a reference to the updated iterator.

bool isPastEnd() const

Indicates if iterator is past end.

Returns:

true if iterator is out of scope, false if end has not been reached.