43 :
BaseIterator(info), polygon_(polygon), start_index_(0, 0)
45 if (polygon.points.size() == 0)
58 for (
const auto& vertex :
polygon_.points)
60 min_x = std::min(min_x, vertex.x);
61 min_y = std::min(min_y, vertex.y);
62 max_x = std::max(max_x, vertex.x);
63 max_y = std::max(max_y, vertex.y);
70 unsigned int max_x_grid, max_y_grid;
93 nav_2d_msgs::Polygon2D polygon,
94 unsigned int min_x,
unsigned int min_y,
unsigned int width,
unsigned int height,
137 ++(*internal_iterator_);
143 ++(*internal_iterator_);
PolygonFill(const nav_grid::NavGridInfo *info, nav_2d_msgs::Polygon2D polygon)
Public Constructor.
bool equals(const nav_2d_msgs::Polygon2D &polygon0, const nav_2d_msgs::Polygon2D &polygon1)
void gridToWorld(const NavGridInfo &info, int mx, int my, double &wx, double &wy)
nav_2d_msgs::Polygon2D polygon_
const nav_grid::NavGridInfo * info_
void increment() override
Increase the iterator to the next element.
nav_grid::Index start_index_
PolygonFill end() const override
Helper function for range-style iteration.
bool fieldsEqual(const PolygonFill &other) override
Additional check for whether fields of derived iterators are equal.
Iterates over all of the valid indexes that lie within an arbitrary polygon in row major order...
PolygonFill begin() const override
Helper function for range-style iteration Equivalent to the above constructor.
Iterator for looping through every index within an aligned rectangular portion of the grid...
bool isInside(unsigned int x, unsigned int y) const
Check if given index is inside the polygon.
PolygonFill & operator=(const PolygonFill &other)
Assignment Operator Required to ensure unique_ptr is set properly.
bool worldToGridBounded(const NavGridInfo &info, double wx, double wy, unsigned int &mx, unsigned int &my)
bool isInside(const nav_2d_msgs::Polygon2D &polygon, const double x, const double y)
std::unique_ptr< SubGrid > internal_iterator_