37 #ifndef OMPL_DATASTRUCTURES_GRID_N_
38 #define OMPL_DATASTRUCTURES_GRID_N_
40 #include "ompl/datastructures/Grid.h"
45 template <
typename _T>
46 class GridN :
public Grid<_T>
50 using BaseCell =
typename Grid<_T>::Cell;
69 ~Cell()
override =
default;
71 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
78 explicit GridN(
unsigned int dimension) :
Grid<_T>(dimension)
85 ~
GridN()
override =
default;
131 Coord test = cell->coord;
147 list.reserve(list.size() + baselist.size());
148 for (
const auto &c : baselist)
149 list.push_back(
static_cast<Cell *
>(c));
159 auto *cell =
new Cell();
165 for (
auto cl = list->begin(); cl != list->end(); ++cl)
167 auto *c =
static_cast<Cell *
>(*cl);
175 cell->border =
false;
191 for (
auto cl = list->begin(); cl != list->end(); ++cl)
193 auto *c =
static_cast<Cell *
>(*cl);
213 cells.push_back(
static_cast<Cell *
>(h.second));
220 unsigned int result = 0;
223 for (
unsigned int i = 0; i < Grid<_T>::dimension_; ++i)
249 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
std::vector< Cell * > CellArray
The datatype for arrays of cells.
typename Grid< _T >::Cell BaseCell
Datatype for cell in base class.
typename Grid< _T >::CellArray BaseCellArray
Datatype for array of cells in base class.
bool hasBounds_
Flag indicating whether bounds are in effect for this grid.
bool remove(BaseCell *cell) override
void getCells(CellArray &cells) const
Get the set of instantiated cells in the grid.
void neighbors(const Cell *cell, CellArray &list) const
Get the list of neighbors for a given cell.
Cell * getCell(const Coord &coord) const
Get the cell at a specified coordinate.
typename Grid< _T >::Coord Coord
Datatype for cell coordinates.
std::vector< Cell * > CellArray
The datatype for arrays of cells.
unsigned int numberOfBoundaryDimensions(const Coord &coord) const
Compute how many sides of a coordinate touch the boundaries of the grid.
Definition of a cell in this grid.
BaseCell * createCell(const Coord &coord, BaseCellArray *nbh=nullptr) override
Coord upBound_
If bounds are set, this defines the upper corner cell.
Eigen::VectorXi Coord
Definition of a coordinate within this grid.
void setBounds(const Coord &low, const Coord &up)
unsigned int neighbors
The number of neighbors.
void neighbors(const Cell *cell, CellArray &list) const
Get the list of neighbors for a given cell.
unsigned int interiorCellNeighborsLimit_
void setInteriorCellNeighborLimit(unsigned int count)
iterator end() const
Return the end() iterator for the grid.
bool overrideCellNeighborsLimit_
void setDimension(unsigned int dimension)
Cell * getCell(const Coord &coord) const
Get the cell at a specified coordinate.
GridN(unsigned int dimension)
The constructor takes the dimension of the grid as argument.
Coord lowBound_
If bounds are set, this defines the lower corner cell.
Representation of a grid where cells keep track of how many neighbors they have.
Representation of a simple grid.
Main namespace. Contains everything in this library.
bool border
A flag indicating whether this cell is on the border or not.