#include <LineIterator.hpp>
Public Member Functions | |
bool | isPastEnd () const |
LineIterator (const grid_map::GridMap &gridMap, const Position &start, const Position &end) | |
LineIterator (const grid_map::GridMap &gridMap, const Index &start, const Index &end) | |
bool | operator!= (const LineIterator &other) const |
const Index & | operator* () const |
LineIterator & | operator++ () |
LineIterator & | operator= (const LineIterator &other) |
Private Member Functions | |
bool | getIndexLimitedToMapRange (const grid_map::GridMap &gridMap, const Position &start, const Position &end, Index &index) |
bool | initialize (const grid_map::GridMap &gridMap, const Index &start, const Index &end) |
void | initializeIterationParameters () |
Private Attributes | |
Size | bufferSize_ |
Index | bufferStartIndex_ |
int | denominator_ |
Index | end_ |
Ending index of the line. More... | |
unsigned int | iCell_ = 0 |
Current cell number. More... | |
Size | increment1_ |
Helper variables for Bresenham Line Drawing algorithm. More... | |
Size | increment2_ |
Index | index_ |
Current index. More... | |
Length | mapLength_ |
Map information needed to get position from iterator. More... | |
Position | mapPosition_ |
unsigned int | nCells_ = 0 |
Number of cells in the line. More... | |
int | numerator_ |
int | numeratorAdd_ |
double | resolution_ |
Index | start_ |
Starting index of the line. More... | |
Iterator class to iterate over a line in the map. Based on Bresenham Line Drawing algorithm.
Definition at line 22 of file LineIterator.hpp.
grid_map::LineIterator::LineIterator | ( | const grid_map::GridMap & | gridMap, |
const Position & | start, | ||
const Position & | end | ||
) |
Constructor.
gridMap | the grid map to iterate on. |
start | the starting point of the line. |
end | the ending point of the line. |
std::invalid_argument | if start and end impose an ill conditioned line iteration. |
Definition at line 16 of file LineIterator.cpp.
grid_map::LineIterator::LineIterator | ( | const grid_map::GridMap & | gridMap, |
const Index & | start, | ||
const Index & | end | ||
) |
Constructor.
gridMap | the grid map to iterate on. |
start | the starting index of the line. |
end | the ending index of the line. |
Definition at line 29 of file LineIterator.cpp.
|
private |
Finds the index of a position on a line within the limits of the map.
[in] | gridMap | the grid map that defines the map boundaries. |
[in] | start | the position that will be limited to the map range. |
[in] | end | the ending position of the line. |
[out] | index | the index of the moved start position. |
Definition at line 96 of file LineIterator.cpp.
|
private |
Construct function.
gridMap | the grid map to iterate on. |
start | the starting index of the line. |
end | the ending index of the line. |
Definition at line 83 of file LineIterator.cpp.
|
private |
Computes the parameters requires for the line drawing algorithm.
Definition at line 110 of file LineIterator.cpp.
bool grid_map::LineIterator::isPastEnd | ( | ) | const |
Indicates if iterator is past end.
Definition at line 78 of file LineIterator.cpp.
bool grid_map::LineIterator::operator!= | ( | const LineIterator & | other | ) | const |
Compare to another iterator.
Definition at line 54 of file LineIterator.cpp.
const Index & grid_map::LineIterator::operator* | ( | ) | const |
Dereference the iterator with const.
Definition at line 59 of file LineIterator.cpp.
LineIterator & grid_map::LineIterator::operator++ | ( | ) |
Increase the iterator to the next element.
Definition at line 64 of file LineIterator.cpp.
LineIterator & grid_map::LineIterator::operator= | ( | const LineIterator & | other | ) |
Assignment operator.
iterator | the iterator to copy data from. |
Definition at line 34 of file LineIterator.cpp.
|
private |
Definition at line 125 of file LineIterator.hpp.
|
private |
Definition at line 126 of file LineIterator.hpp.
|
private |
Definition at line 119 of file LineIterator.hpp.
|
private |
Ending index of the line.
Definition at line 109 of file LineIterator.hpp.
|
private |
Current cell number.
Definition at line 112 of file LineIterator.hpp.
|
private |
Helper variables for Bresenham Line Drawing algorithm.
Definition at line 118 of file LineIterator.hpp.
|
private |
Definition at line 118 of file LineIterator.hpp.
|
private |
Current index.
Definition at line 103 of file LineIterator.hpp.
|
private |
Map information needed to get position from iterator.
Definition at line 122 of file LineIterator.hpp.
|
private |
Definition at line 123 of file LineIterator.hpp.
|
private |
Number of cells in the line.
Definition at line 115 of file LineIterator.hpp.
|
private |
Definition at line 119 of file LineIterator.hpp.
|
private |
Definition at line 119 of file LineIterator.hpp.
|
private |
Definition at line 124 of file LineIterator.hpp.
|
private |
Starting index of the line.
Definition at line 106 of file LineIterator.hpp.