Navigation
API > API/Runtime > API/Runtime/GeometryCore
Hash Grid for values associated with 2D points.
This class addresses the situation where you have a list of (point, point_data) and you would like to be able to do efficient proximity queries, i.e. find the nearest point_data for a given query point.
We don't store copies of the 2D points. You provide a point_data type. This could just be the integer index into your list for example, a pointer to something more complex, etc. Insert and Remove functions require you to pass in the 2D point for the point_data. To Update a point you need to know its old and new 2D coordinates.
| Name | TPointHashGrid2 |
| Type | class |
| Header File | /Engine/Source/Runtime/GeometryCore/Public/Spatial/PointHashGrid2.h |
| Include Path | #include "Spatial/PointHashGrid2.h" |
Syntax
template<typename PointDataType, typename RealType>
class TPointHashGrid2
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TPointHashGrid2
(
RealType cellSize, |
Construct 2D hash grid | Spatial/PointHashGrid2.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CriticalSection | FCriticalSection | Spatial/PointHashGrid2.h | ||
| Hash | TMultiMap< FVector2i, PointDataType > | Spatial/PointHashGrid2.h | ||
| Indexer | TScaleGridIndexer2< RealType > | Spatial/PointHashGrid2.h | ||
| InvalidValue | PointDataType | Spatial/PointHashGrid2.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TPair< PointDataType, RealType > FindNearestInRadius
(
const TVector2< RealType >& QueryPoint, |
Find nearest point in grid, within a given sphere, without locking / thread-safety. | Spatial/PointHashGrid2.h | |
PointDataType GetInvalidValue() |
Invalid grid value | Spatial/PointHashGrid2.h | |
void InsertPoint
(
const PointDataType& Value, |
Insert at given position. This function is thread-safe. | Spatial/PointHashGrid2.h | |
void InsertPointUnsafe
(
const PointDataType& Value, |
Insert at given position, without locking / thread-safety | Spatial/PointHashGrid2.h | |
bool RemovePoint
(
const PointDataType& Value, |
Remove at given position. This function is thread-safe. | Spatial/PointHashGrid2.h | |
bool RemovePointUnsafe
(
const PointDataType& Value, |
Remove at given position, without locking / thread-safety | Spatial/PointHashGrid2.h | |
void Reserve
(
int32 Num |
Reserve space in the underlying hash map | Spatial/PointHashGrid2.h | |
| Move value from old to new position. This function is thread-safe. | Spatial/PointHashGrid2.h | ||
| Move value from old to new position, without locking / thread-safety | Spatial/PointHashGrid2.h |