UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSquare2DGridHelper::FGrid2D Struct Reference

#include <RuntimeSpatialHashGridHelper.h>

+ Inheritance diagram for FSquare2DGridHelper::FGrid2D:

Public Member Functions

 FGrid2D (const FVector2D &InOrigin, int64 InCellSize, int64 InGridSize)
 
bool IsValidCoords (const FGridCellCoord2 &InCoords) const
 
bool GetCellBounds (int64 InIndex, FBox2D &OutBounds) const
 
bool GetCellBounds (const FGridCellCoord2 &InCoords, FBox2D &OutBounds, bool bCheckIsValidCoord=true) const
 
bool GetCellCoords (const FVector2D &InPos, FGridCellCoord2 &OutCoords) const
 
bool GetCellCoords (const FBox2D &InBounds2D, FGridCellCoord2 &OutMinCellCoords, FGridCellCoord2 &OutMaxCellCoords) const
 
bool GetCellIndex (const FGridCellCoord2 &InCoords, uint64 &OutIndex) const
 
bool GetCellIndex (const FVector &InPos, uint64 &OutIndex) const
 
int32 GetNumIntersectingCells (const FBox &InBox) const
 
int32 ForEachIntersectingCellsBreakable (const FBox &InBox, TFunctionRef< bool(const FGridCellCoord2 &)> InOperation) const
 
int32 ForEachIntersectingCells (const FBox &InBox, TFunctionRef< void(const FGridCellCoord2 &)> InOperation) const
 
int32 ForEachIntersectingCells (const FSphere &InSphere, TFunctionRef< void(const FGridCellCoord2 &)> InOperation) const
 
int32 ForEachIntersectingCells (const FSphericalSector &InShape, TFunctionRef< void(const FGridCellCoord2 &)> InOperation) const
 

Public Attributes

FVector2D Origin
 
int64 CellSize
 
int64 GridSize
 

Constructor & Destructor Documentation

◆ FGrid2D()

FSquare2DGridHelper::FGrid2D::FGrid2D ( const FVector2D InOrigin,
int64  InCellSize,
int64  InGridSize 
)
inline

Member Function Documentation

◆ ForEachIntersectingCells() [1/3]

int32 FSquare2DGridHelper::FGrid2D::ForEachIntersectingCells ( const FBox InBox,
TFunctionRef< void(const FGridCellCoord2 &)>  InOperation 
) const
inline

◆ ForEachIntersectingCells() [2/3]

int32 FSquare2DGridHelper::FGrid2D::ForEachIntersectingCells ( const FSphere InSphere,
TFunctionRef< void(const FGridCellCoord2 &)>  InOperation 
) const
inline

Runs a function on all intersecting cells for the provided sphere

Returns
the number of intersecting cells

◆ ForEachIntersectingCells() [3/3]

int32 FSquare2DGridHelper::FGrid2D::ForEachIntersectingCells ( const FSphericalSector InShape,
TFunctionRef< void(const FGridCellCoord2 &)>  InOperation 
) const

Runs a function on all intersecting cells for the provided spherical sector

Returns
the number of intersecting cells

◆ ForEachIntersectingCellsBreakable()

int32 FSquare2DGridHelper::FGrid2D::ForEachIntersectingCellsBreakable ( const FBox InBox,
TFunctionRef< bool(const FGridCellCoord2 &)>  InOperation 
) const
inline

Runs a function on all intersecting cells for the provided box

Returns
the number of intersecting cells

◆ GetCellBounds() [1/2]

bool FSquare2DGridHelper::FGrid2D::GetCellBounds ( const FGridCellCoord2 InCoords,
FBox2D OutBounds,
bool  bCheckIsValidCoord = true 
) const
inline

Returns the cell bounds

Returns
true if the specified coord was valid

◆ GetCellBounds() [2/2]

bool FSquare2DGridHelper::FGrid2D::GetCellBounds ( int64  InIndex,
FBox2D OutBounds 
) const
inline

Returns the cell bounds

Returns
true if the specified index was valid

◆ GetCellCoords() [1/2]

bool FSquare2DGridHelper::FGrid2D::GetCellCoords ( const FBox2D InBounds2D,
FGridCellCoord2 OutMinCellCoords,
FGridCellCoord2 OutMaxCellCoords 
) const
inline

Returns the cells coordinates of the provided box

Returns
true if the bounds was intersecting with the grid

◆ GetCellCoords() [2/2]

bool FSquare2DGridHelper::FGrid2D::GetCellCoords ( const FVector2D InPos,
FGridCellCoord2 OutCoords 
) const
inline

Returns the cell coordinates of the provided position

Returns
true if the position was inside the grid

◆ GetCellIndex() [1/2]

bool FSquare2DGridHelper::FGrid2D::GetCellIndex ( const FGridCellCoord2 InCoords,
uint64 OutIndex 
) const
inline

Returns the cell index of the provided coords

Returns
true if the coords was inside the grid

◆ GetCellIndex() [2/2]

bool FSquare2DGridHelper::FGrid2D::GetCellIndex ( const FVector InPos,
uint64 OutIndex 
) const
inline

Returns the cell index of the provided position

Returns
true if the position was inside the grid

◆ GetNumIntersectingCells()

int32 FSquare2DGridHelper::FGrid2D::GetNumIntersectingCells ( const FBox InBox) const
inline

Get the number of intersecting cells of the provided box

Returns
the number of intersecting cells

◆ IsValidCoords()

bool FSquare2DGridHelper::FGrid2D::IsValidCoords ( const FGridCellCoord2 InCoords) const
inline

Validate that the coordinates fit the grid size

Returns
true if the specified coordinates are valid

Member Data Documentation

◆ CellSize

int64 FSquare2DGridHelper::FGrid2D::CellSize

◆ GridSize

int64 FSquare2DGridHelper::FGrid2D::GridSize

◆ Origin

FVector2D FSquare2DGridHelper::FGrid2D::Origin

The documentation for this struct was generated from the following files: