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. | |
CircleOutline (const nav_grid::NavGridInfo *info, double center_x, double center_y, unsigned int radius) | |
Public Constructor with integer radius. | |
Standard BaseIterator Interface | |
CircleOutline | begin () const override |
Helper function for range-style iteration Equivalent to the above constructor. | |
CircleOutline | end () const override |
Helper function for range-style iteration. | |
void | increment () override |
Increase the iterator to the next element. | |
bool | fieldsEqual (const CircleOutline &other) override |
Additional check for whether fields of derived iterators are equal. | |
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. | |
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. | |
bool | isValidIndex (int x, int y) const |
Check if arbitrary coordinates are within the grid. | |
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_ |
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.
nav_grid_iterators::CircleOutline::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] |
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.
CircleOutline nav_grid_iterators::CircleOutline::begin | ( | ) | const [override, virtual] |
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.
CircleOutline nav_grid_iterators::CircleOutline::end | ( | ) | const [override, virtual] |
Helper function for range-style iteration.
Implements nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 86 of file circle_outline.cpp.
bool nav_grid_iterators::CircleOutline::fieldsEqual | ( | const CircleOutline & | other | ) | [override, virtual] |
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.
void nav_grid_iterators::CircleOutline::increment | ( | ) | [override, virtual] |
Increase the iterator to the next element.
Implements nav_grid_iterators::BaseIterator< CircleOutline >.
Definition at line 92 of file circle_outline.cpp.
bool nav_grid_iterators::CircleOutline::isOnOutline | ( | int | dx, |
int | dy | ||
) | const [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.
bool nav_grid_iterators::CircleOutline::isValidIndex | ( | int | x, |
int | y | ||
) | const [protected] |
Check if arbitrary coordinates are within the grid.
Definition at line 133 of file circle_outline.cpp.
int nav_grid_iterators::CircleOutline::center_index_x_ [protected] |
Definition at line 114 of file circle_outline.h.
int nav_grid_iterators::CircleOutline::center_index_y_ [protected] |
Definition at line 114 of file circle_outline.h.
unsigned int nav_grid_iterators::CircleOutline::distance_ [protected] |
Definition at line 115 of file circle_outline.h.
bool nav_grid_iterators::CircleOutline::init_ [protected] |
Definition at line 116 of file circle_outline.h.
int nav_grid_iterators::CircleOutline::point_x_ [protected] |
Definition at line 118 of file circle_outline.h.
int nav_grid_iterators::CircleOutline::point_y_ [protected] |
Definition at line 118 of file circle_outline.h.
int nav_grid_iterators::CircleOutline::signed_height_ [protected] |
Definition at line 117 of file circle_outline.h.
int nav_grid_iterators::CircleOutline::signed_width_ [protected] |
Definition at line 117 of file circle_outline.h.
nav_grid::Index nav_grid_iterators::CircleOutline::start_index_ [protected] |
Definition at line 119 of file circle_outline.h.