Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nav_grid_iterators::CircleOutline Class Reference

Iterates over the valid indexes that lie on the outline of a circle. More...

#include <circle_outline.h>

Inheritance diagram for nav_grid_iterators::CircleOutline:
Inheritance graph
[legend]

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::Indexoperator* () const
 Dereference the iterator. More...
 
CircleOutlineoperator++ ()
 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::NavGridInfoinfo_
 

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
 

Detailed Description

Iterates over the valid indexes that lie on the outline of a circle.

Definition at line 57 of file circle_outline.h.

Constructor & Destructor Documentation

nav_grid_iterators::CircleOutline::CircleOutline ( const nav_grid::NavGridInfo info,
double  center_x,
double  center_y,
double  radius 
)

Public Constructor.

Parameters
infoNavGridInfo for the grid to iterate over
center_xCenter of the circle (x coordinate)
center_yCenter of the circle (y coordinate)
radiusSize 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.

Parameters
infoNavGridInfo for the grid to iterate over
center_xCenter of the circle (x coordinate)
center_yCenter of the circle (y coordinate)
radiusSize 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.

Parameters
infoNavGridInfo for the grid to iterate over
indexInitial index
center_index_xIndex of the center of the circle (x coordinate)
center_index_yIndex of the center of the circle (y coordinate)
distanceThe number of cells in the radius of the circle
initWhether the first cell has been visited or not
start_indexThe first valid index in the minimum row

Definition at line 67 of file circle_outline.cpp.

Member Function Documentation

CircleOutline nav_grid_iterators::CircleOutline::begin ( ) const
overridevirtual

Helper function for range-style iteration Equivalent to the above constructor.

Returns
Iterator representing beginning of the iteration

Implements nav_grid_iterators::BaseIterator< CircleOutline >.

Definition at line 80 of file circle_outline.cpp.

CircleOutline nav_grid_iterators::CircleOutline::end ( ) const
overridevirtual

Helper function for range-style iteration.

Returns
Iterator representing end of the iteration, with an invalid index

Implements nav_grid_iterators::BaseIterator< CircleOutline >.

Definition at line 86 of file circle_outline.cpp.

bool nav_grid_iterators::CircleOutline::fieldsEqual ( const CircleOutline other)
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.

void nav_grid_iterators::CircleOutline::increment ( )
overridevirtual

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.

Returns
true if the distance to the cell when rounded to an integer is equal to the distance_

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.

Returns
true if inside grid, false otherwise.

Definition at line 133 of file circle_outline.cpp.

Member Data Documentation

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.


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


nav_grid_iterators
Author(s):
autogenerated on Wed Jun 26 2019 20:06:20