n-dimensional grid structure with uniform non-cubic cells This data structure is useful to search for neighbors in a given range (the size of each cell)
More...
#include <SurgSim/DataStructures/Grid.h>
|
struct | CellContent |
| Data structure for a cell's content (the list of elements and the list of all the neighbors) More...
|
|
class | NDIdHash |
| Enable the NDId to be used as a key in an unordered map. More...
|
|
|
| Grid (const Eigen::Matrix< double, N, 1 > &cellSize, const Eigen::AlignedBox< double, N > &bounds) |
| Constructor. More...
|
|
virtual | ~Grid () |
| Destructor. More...
|
|
void | reset () |
| Reset the grid content and the neighbors' mapping. More...
|
|
template<class Derived > |
void | addElement (const T element, const Eigen::MatrixBase< Derived > &position) |
| Add an element in the grid. More...
|
|
const std::vector< T > & | getNeighbors (const T &element) |
| Retrieve an elements' neighbors. More...
|
|
template<class Derived > |
const std::vector< T > & | getNeighbors (const Eigen::MatrixBase< Derived > &position) |
| Retrieve the neighbors of a location. More...
|
|
|
typedef Eigen::Matrix< int, N, 1 > | NDId |
| The type of the n-dimensional cell Id. More...
|
|
template<typename T, size_t N>
class SurgSim::DataStructures::Grid< T, N >
n-dimensional grid structure with uniform non-cubic cells This data structure is useful to search for neighbors in a given range (the size of each cell)
- Template Parameters
-
T | Element type to be stored |
N | The dimension of the grid (i.e. 2 => 2D, 3 => 3D) |
◆ NDId
template<typename T, size_t N>
The type of the n-dimensional cell Id.
◆ Grid()
template<typename T , size_t N>
Constructor.
- Parameters
-
cellSize | The size of each cell in dimension N (i.e. cells are not necessarily cubic). |
bounds | The dimension-N boundaries of the space covered by the grid. |
◆ ~Grid()
template<typename T , size_t N>
◆ addElement()
template<typename T, size_t N>
template<class Derived >
Add an element in the grid.
- Parameters
-
element | to be added at this position |
position | of the element in the n-D space |
- Note
- If the position is outside of the grid, the element is simply not added to the grid
Flag that the neighbors list will need to be recomputed on the next access
◆ getNeighbors() [1/2]
template<typename T , size_t N>
template<class Derived >
Retrieve the neighbors of a location.
- Parameters
-
position | The position for which the neighbors are requested |
- Returns
- The neighbors for this position, i.e. all the elements in the positions cell and all surrounding cells
◆ getNeighbors() [2/2]
template<typename T, size_t N>
Retrieve an elements' neighbors.
- Parameters
-
element | The element for which the neighbors are requested |
- Returns
- The element's neighbors list (including the element itself)
◆ getNeighborsCellIds()
template<typename T , size_t N>
Retrieve the neighboring cells id (including this cell)
- Parameters
-
cellId | for which the neighbors cells are requested |
cellsIds | [out] Neighbors cells ids |
◆ isNdGreaterOrEqual()
template<typename T , size_t N>
- Parameters
-
a | The first cell ID. |
b | The second cell ID. |
- Returns
- true if a is > b.
◆ reset()
template<typename T , size_t N>
Reset the grid content and the neighbors' mapping.
◆ update()
template<typename T , size_t N>
Update the neighbors lists.
◆ m_aabb
template<typename T, size_t N>
◆ m_activeCells
template<typename T, size_t N>
Active cells (referenced by their ids (spatial hashing)) with their content.
◆ m_cellIds
template<typename T, size_t N>
Mapping from element to cell id containing the element.
◆ m_neighborsDirtyFlag
template<typename T, size_t N>
Does the neighbors needs to be recomputed ?
◆ m_size
template<typename T, size_t N>
Size of each cell (same on all dimension)
The documentation for this class was generated from the following files: