Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
grid_map::LineIterator Class Reference

#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 Indexoperator* () const
 
LineIteratoroperator++ ()
 

Private Member Functions

bool initialize (const grid_map::GridMap &gridMap, const Index &start, const Index &end)
 
void initializeIterationParameters ()
 

Static Private Member Functions

static bool getIndexLimitedToMapRange (const grid_map::GridMap &gridMap, const Position &start, const Position &end, Index &index)
 

Private Attributes

Size bufferSize_
 
Index bufferStartIndex_
 
int denominator_ {0}
 
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_ {0}
 
int numeratorAdd_ {0}
 
double resolution_ {NAN}
 
Index start_
 Starting index of the line. More...
 

Detailed Description

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

Definition at line 22 of file LineIterator.hpp.

Constructor & Destructor Documentation

◆ LineIterator() [1/2]

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

Constructor.

Parameters
gridMapthe grid map to iterate on.
startthe starting point of the line.
endthe ending point of the line.
Exceptions
std::invalid_argumentif start and end impose an ill conditioned line iteration.

Definition at line 14 of file LineIterator.cpp.

◆ LineIterator() [2/2]

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

Constructor.

Parameters
gridMapthe grid map to iterate on.
startthe starting index of the line.
endthe ending index of the line.

Definition at line 28 of file LineIterator.cpp.

Member Function Documentation

◆ getIndexLimitedToMapRange()

bool grid_map::LineIterator::getIndexLimitedToMapRange ( const grid_map::GridMap gridMap,
const Position start,
const Position end,
Index index 
)
staticprivate

Finds the index of a position on a line within the limits of the map.

Parameters
[in]gridMapthe grid map that defines the map boundaries.
[in]startthe position that will be limited to the map range.
[in]endthe ending position of the line.
[out]indexthe index of the moved start position.
Returns
true if successful, false otherwise.

Definition at line 75 of file LineIterator.cpp.

◆ initialize()

bool grid_map::LineIterator::initialize ( const grid_map::GridMap gridMap,
const Index start,
const Index end 
)
private

Construct function.

Parameters
gridMapthe grid map to iterate on.
startthe starting index of the line.
endthe ending index of the line.
Returns
true if successful, false otherwise.

Definition at line 62 of file LineIterator.cpp.

◆ initializeIterationParameters()

void grid_map::LineIterator::initializeIterationParameters ( )
private

Computes the parameters requires for the line drawing algorithm.

Definition at line 90 of file LineIterator.cpp.

◆ isPastEnd()

bool grid_map::LineIterator::isPastEnd ( ) const

Indicates if iterator is past end.

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

Definition at line 57 of file LineIterator.cpp.

◆ operator!=()

bool grid_map::LineIterator::operator!= ( const LineIterator other) const

Compare to another iterator.

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

Definition at line 33 of file LineIterator.cpp.

◆ operator*()

const Index & grid_map::LineIterator::operator* ( ) const

Dereference the iterator with const.

Returns
the value to which the iterator is pointing.

Definition at line 38 of file LineIterator.cpp.

◆ operator++()

LineIterator & grid_map::LineIterator::operator++ ( )

Increase the iterator to the next element.

Returns
a reference to the updated iterator.

Definition at line 43 of file LineIterator.cpp.

Member Data Documentation

◆ bufferSize_

Size grid_map::LineIterator::bufferSize_
private

Definition at line 118 of file LineIterator.hpp.

◆ bufferStartIndex_

Index grid_map::LineIterator::bufferStartIndex_
private

Definition at line 119 of file LineIterator.hpp.

◆ denominator_

int grid_map::LineIterator::denominator_ {0}
private

Definition at line 112 of file LineIterator.hpp.

◆ end_

Index grid_map::LineIterator::end_
private

Ending index of the line.

Definition at line 102 of file LineIterator.hpp.

◆ iCell_

unsigned int grid_map::LineIterator::iCell_ = 0
private

Current cell number.

Definition at line 105 of file LineIterator.hpp.

◆ increment1_

Size grid_map::LineIterator::increment1_
private

Helper variables for Bresenham Line Drawing algorithm.

Definition at line 111 of file LineIterator.hpp.

◆ increment2_

Size grid_map::LineIterator::increment2_
private

Definition at line 111 of file LineIterator.hpp.

◆ index_

Index grid_map::LineIterator::index_
private

Current index.

Definition at line 96 of file LineIterator.hpp.

◆ mapLength_

Length grid_map::LineIterator::mapLength_
private

Map information needed to get position from iterator.

Definition at line 115 of file LineIterator.hpp.

◆ mapPosition_

Position grid_map::LineIterator::mapPosition_
private

Definition at line 116 of file LineIterator.hpp.

◆ nCells_

unsigned int grid_map::LineIterator::nCells_ = 0
private

Number of cells in the line.

Definition at line 108 of file LineIterator.hpp.

◆ numerator_

int grid_map::LineIterator::numerator_ {0}
private

Definition at line 112 of file LineIterator.hpp.

◆ numeratorAdd_

int grid_map::LineIterator::numeratorAdd_ {0}
private

Definition at line 112 of file LineIterator.hpp.

◆ resolution_

double grid_map::LineIterator::resolution_ {NAN}
private

Definition at line 117 of file LineIterator.hpp.

◆ start_

Index grid_map::LineIterator::start_
private

Starting index of the line.

Definition at line 99 of file LineIterator.hpp.


The documentation for this class was generated from the following files:


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Wed Jul 5 2023 02:23:35