Iterates over the valid indexes that lie on the outline of a circle. More...
#include <circle_outline.h>
Public Member Functions | |
CircleOutline (const nav_grid::NavGridInfo *info, double center_x, double center_y, double radius) | |
Public Constructor. More... | |
CircleOutline (const nav_grid::NavGridInfo *info, double center_x, double center_y, unsigned int radius) | |
Public Constructor with integer radius. More... | |
Standard BaseIterator Interface | |
CircleOutline | begin () const override |
Helper function for range-style iteration Equivalent to the above constructor. More... | |
CircleOutline | end () const override |
Helper function for range-style iteration. More... | |
void | increment () override |
Increase the iterator to the next element. More... | |
bool | fieldsEqual (const CircleOutline &other) override |
Additional check for whether fields of derived iterators are equal. More... | |
Public Member Functions inherited from nav_grid_iterators::BaseIterator< CircleOutline > | |
BaseIterator (const nav_grid::NavGridInfo *info) | |
Public Constructor. Takes in a pointer to the info and starts at the minimum index. More... | |
BaseIterator (const nav_grid::NavGridInfo &info) | |
Public Constructor. Takes in a reference to the info and starts at the minimum index. More... | |
bool | operator!= (const CircleOutline &other) |
Test if two iterators are not equivalent - required for testing if iterator is at the end. More... | |
const nav_grid::Index & | operator* () const |
Dereference the iterator. More... | |
CircleOutline & | operator++ () |
Increase the iterator to the next element. More... | |
bool | operator== (const CircleOutline &other) |
Test if two iterators are equivalent. More... | |
virtual | ~BaseIterator ()=default |
Destructor. More... | |
Protected Member Functions | |
CircleOutline (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, int center_index_x, int center_index_y, unsigned int distance, bool init, const nav_grid::Index &start_index) | |
Protected constructor that takes in an arbitrary index and other internal parameters. More... | |
bool | isOnOutline (int dx, int dy) const |
Check if a cell with the given distance from the center of the circle is on the outline of the circle. More... | |
bool | isValidIndex (int x, int y) const |
Check if arbitrary coordinates are within the grid. More... | |
Protected Member Functions inherited from nav_grid_iterators::BaseIterator< CircleOutline > | |
BaseIterator (const nav_grid::NavGridInfo *info, const nav_grid::Index &index) | |
Protected constructor that takes in an arbitrary index. More... | |
Protected Attributes | |
int | center_index_x_ |
int | center_index_y_ |
unsigned int | distance_ |
bool | init_ |
int | point_x_ |
int | point_y_ |
int | signed_height_ |
int | signed_width_ |
nav_grid::Index | start_index_ |
Protected Attributes inherited from nav_grid_iterators::BaseIterator< CircleOutline > | |
nav_grid::Index | index_ |
const nav_grid::NavGridInfo * | info_ |
Additional Inherited Members | |
Public Types inherited from nav_grid_iterators::BaseIterator< CircleOutline > | |
using | difference_type = int |
using | iterator_category = std::input_iterator_tag |
using | pointer = nav_grid::Index * |
using | reference = nav_grid::Index & |
using | self_type = CircleOutline |
using | value_type = nav_grid::Index |
Iterates over the valid indexes that lie on the outline of a circle.
Definition at line 57 of file circle_outline.h.
nav_grid_iterators::CircleOutline::CircleOutline | ( | const nav_grid::NavGridInfo * | info, |
double | center_x, | ||
double | center_y, | ||
double | radius | ||
) |
Public Constructor.
info | NavGridInfo for the grid to iterate over |
center_x | Center of the circle (x coordinate) |
center_y | Center of the circle (y coordinate) |
radius | Size of the circle |
Definition at line 40 of file circle_outline.cpp.
nav_grid_iterators::CircleOutline::CircleOutline | ( | const nav_grid::NavGridInfo * | info, |
double | center_x, | ||
double | center_y, | ||
unsigned int | radius | ||
) |
Public Constructor with integer radius.
info | NavGridInfo for the grid to iterate over |
center_x | Center of the circle (x coordinate) |
center_y | Center of the circle (y coordinate) |
radius | Size of the circle |
Definition at line 45 of file circle_outline.cpp.
|
protected |
Protected constructor that takes in an arbitrary index and other internal parameters.
info | NavGridInfo for the grid to iterate over |
index | Initial index |
center_index_x | Index of the center of the circle (x coordinate) |
center_index_y | Index of the center of the circle (y coordinate) |
distance | The number of cells in the radius of the circle |
init | Whether the first cell has been visited or not |
start_index | The first valid index in the minimum row |
Definition at line 67 of file circle_outline.cpp.
|
overridevirtual |
Helper function for range-style iteration Equivalent to the above constructor.
Implements nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 80 of file circle_outline.cpp.
|
overridevirtual |
Helper function for range-style iteration.
Implements nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 86 of file circle_outline.cpp.
|
overridevirtual |
Additional check for whether fields of derived iterators are equal.
Helps make overriding the == operator easy.
Reimplemented from nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 127 of file circle_outline.cpp.
|
overridevirtual |
Increase the iterator to the next element.
Implements nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 92 of file circle_outline.cpp.
|
protected |
Check if a cell with the given distance from the center of the circle is on the outline of the circle.
Definition at line 138 of file circle_outline.cpp.
|
protected |
Check if arbitrary coordinates are within the grid.
Definition at line 133 of file circle_outline.cpp.
|
protected |
Definition at line 114 of file circle_outline.h.
|
protected |
Definition at line 114 of file circle_outline.h.
|
protected |
Definition at line 115 of file circle_outline.h.
|
protected |
Definition at line 116 of file circle_outline.h.
|
protected |
Definition at line 118 of file circle_outline.h.
|
protected |
Definition at line 118 of file circle_outline.h.
|
protected |
Definition at line 117 of file circle_outline.h.
|
protected |
Definition at line 117 of file circle_outline.h.
|
protected |
Definition at line 119 of file circle_outline.h.