Navigation
API > API/Runtime > API/Runtime/GeometryCore
Dynamic sparse 2D grid. Useful in cases where we have grid of some type of non-trivial object and we don't want to pre-allocate full grid of them. So we allocate on-demand. This can be used to implement multi-grid schemes, eg for example the ElemType could be sub-grid of fixed dimension.
| Name | TSparseGrid2 |
| Type | class |
| Header File | /Engine/Source/Runtime/GeometryCore/Public/Spatial/SparseGrid2.h |
| Include Path | #include "Spatial/SparseGrid2.h" |
Syntax
template<typename ElemType>
class TSparseGrid2
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TSparseGrid2
(
const TSparseGrid2& Other |
Spatial/SparseGrid2.h | ||
TSparseGrid2 () |
Create empty grid | Spatial/SparseGrid2.h | |
TSparseGrid2
(
TSparseGrid2&& Other |
Spatial/SparseGrid2.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TSparseGrid2() |
Deletes all grid elements | Spatial/SparseGrid2.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AllocatedIteration
(
Func ElementFunc |
Iterate over existing elements and apply ElementFunc(ElementType) to each of them | Spatial/SparseGrid2.h | |
bool Free
(
const FVector2i& Index |
Delete an element in the grid | Spatial/SparseGrid2.h | |
void FreeAll() |
Delete all elements in the grid | Spatial/SparseGrid2.h | |
| Get the grid element at this index, and optionally allocate it if it doesn't exist | Spatial/SparseGrid2.h | ||
| Get the grid element at this index | Spatial/SparseGrid2.h | ||
SIZE_T GetAllocatedSize() |
Spatial/SparseGrid2.h | ||
FAxisAlignedBox2i GetBoundsInclusive() |
Spatial/SparseGrid2.h | ||
int GetCount() |
Spatial/SparseGrid2.h | ||
float GetDensity() |
Spatial/SparseGrid2.h | ||
FVector2i GetDimensions() |
Spatial/SparseGrid2.h | ||
bool Has
(
const FVector2i& Index |
Spatial/SparseGrid2.h | ||
| Iterate over existing allocated elements within the integer bounds defined by Min and Max (inclusive), and apply ElementFunc(ElementType) to each of them | Spatial/SparseGrid2.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
ElemType * Allocate
(
const FVector2i& index |
Spatial/SparseGrid2.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TSparseGrid2 & operator=
(
const TSparseGrid2& Other |
Spatial/SparseGrid2.h | ||
TSparseGrid2 & operator=
(
TSparseGrid2&& Other |
Spatial/SparseGrid2.h |