UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TSimpleCellGrid< CellType, InvalidCellValue > Struct Template Reference

#include <SimpleCellGrid.h>

Public Types

typedef CellType FCellType
 

Public Member Functions

 TSimpleCellGrid ()
 
bool Init (const float InCellSize, const FBox &Bounds)
 
bool Init (const float InCellSize, const FGridSize2D &InGridSize, const FVector &InOrigin, const float VerticalBoundSize)
 
void SetVerticalInterval (const FFloatInterval &VerticalInterval)
 
void UpdateWorldBounds ()
 
bool IsValid () const
 
bool IsValidIndex (const int32 CellIndex) const
 
bool IsValidCoord (int32 LocationX, int32 LocationY) const
 
bool IsValidCoord (const FIntVector &CellCoords) const
 
uint32 GetAllocatedSize () const
 
FIntVector GetCellCoordsUnsafe (const FVector &WorldLocation) const
 
FIntVector GetCellCoords (const FVector &WorldLocation) const
 
int32 GetCellCoordX (int32 CellIndex) const
 
int32 GetCellCoordY (int32 CellIndex) const
 
FIntVector GetCellCoords (int32 CellIndex) const
 
int32 GetCellIndexUnsafe (const FVector &WorldLocation) const
 
int32 GetCellIndexUnsafe (const FIntVector &CellCoords) const
 
int32 GetCellIndexUnsafe (int32 LocationX, int32 LocationY) const
 
int32 GetCellIndex (int32 LocationX, int32 LocationY) const
 
int32 GetCellIndex (const FVector &WorldLocation) const
 
FBox GetWorldCellBox (int32 CellIndex) const
 
FBox GetWorldCellBox (int32 LocationX, int32 LocationY) const
 
FBox2D GetWorldCellBox2D (int32 CellIndex) const
 
FBox2D GetWorldCellBox2D (int32 LocationX, int32 LocationY) const
 
FBox GetWorldCellRectangleBox (const FIntRect &CellRect) const
 
FIntRect GetCellRectangleFromBox (const FBox &WorldBox) const
 
FIntRect GetGridRectangle () const
 
FVector GetWorldCellCenter (int32 CellIndex) const
 
FVector GetWorldCellCenter (int32 LocationX, int32 LocationY) const
 
const FCellTypeGetCellAtWorldLocationUnsafe (const FVector &WorldLocation) const
 
const FCellTypeGetCellAtWorldLocation (const FVector &WorldLocation) const
 
FCellTypeoperator[] (int32 CellIndex)
 
const FCellTypeoperator[] (int32 CellIndex) const
 
FCellTypeGetCellAtIndexUnsafe (int32 CellIndex)
 
const FCellTypeGetCellAtIndexUnsafe (int32 CellIndex) const
 
FCellTypeGetCellAtCoordsUnsafe (int32 LocationX, int32 LocationY)
 
const FCellTypeGetCellAtCoordsUnsafe (int32 LocationX, int32 LocationY) const
 
int32 GetCellsCount () const
 
int32 Num () const
 
void Serialize (FArchive &Ar)
 
void AllocateMemory ()
 
void FreeMemory ()
 
void Zero ()
 
void CleanUp ()
 

Public Attributes

float GridCellSize
 
FBox WorldBounds
 
FVector Origin
 
FVector BoundsSize
 
FGridSize2D GridSize
 

Protected Attributes

TArray< FCellTypeCells
 

Detailed Description

template<typename CellType, int InvalidCellValue = 0>
struct TSimpleCellGrid< CellType, InvalidCellValue >

No virtuals on purpose

Member Typedef Documentation

◆ FCellType

template<typename CellType , int InvalidCellValue = 0>
typedef CellType TSimpleCellGrid< CellType, InvalidCellValue >::FCellType

Constructor & Destructor Documentation

◆ TSimpleCellGrid()

template<typename CellType , int InvalidCellValue = 0>
TSimpleCellGrid< CellType, InvalidCellValue >::TSimpleCellGrid ( )
inline

Member Function Documentation

◆ AllocateMemory()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::AllocateMemory ( )
inline

◆ CleanUp()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::CleanUp ( )
inline

◆ FreeMemory()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::FreeMemory ( )
inline

◆ GetAllocatedSize()

template<typename CellType , int InvalidCellValue = 0>
uint32 TSimpleCellGrid< CellType, InvalidCellValue >::GetAllocatedSize ( ) const
inline

◆ GetCellAtCoordsUnsafe() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtCoordsUnsafe ( int32  LocationX,
int32  LocationY 
)
inline

◆ GetCellAtCoordsUnsafe() [2/2]

template<typename CellType , int InvalidCellValue = 0>
const FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtCoordsUnsafe ( int32  LocationX,
int32  LocationY 
) const
inline

◆ GetCellAtIndexUnsafe() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtIndexUnsafe ( int32  CellIndex)
inline

◆ GetCellAtIndexUnsafe() [2/2]

template<typename CellType , int InvalidCellValue = 0>
const FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtIndexUnsafe ( int32  CellIndex) const
inline

◆ GetCellAtWorldLocation()

template<typename CellType , int InvalidCellValue = 0>
const FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtWorldLocation ( const FVector WorldLocation) const
inline

◆ GetCellAtWorldLocationUnsafe()

template<typename CellType , int InvalidCellValue = 0>
const FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::GetCellAtWorldLocationUnsafe ( const FVector WorldLocation) const
inline

◆ GetCellCoords() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FIntVector TSimpleCellGrid< CellType, InvalidCellValue >::GetCellCoords ( const FVector WorldLocation) const
inline

Convert world location to (X,Y) coords on grid, result is clamped to grid

◆ GetCellCoords() [2/2]

template<typename CellType , int InvalidCellValue = 0>
FIntVector TSimpleCellGrid< CellType, InvalidCellValue >::GetCellCoords ( int32  CellIndex) const
inline

Convert cell index to (X,Y) coords on grid

◆ GetCellCoordsUnsafe()

template<typename CellType , int InvalidCellValue = 0>
FIntVector TSimpleCellGrid< CellType, InvalidCellValue >::GetCellCoordsUnsafe ( const FVector WorldLocation) const
inline

Convert world location to (X,Y) coords on grid, result can be outside grid

◆ GetCellCoordX()

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellCoordX ( int32  CellIndex) const
inline

Convert cell index to coord X on grid, result can be invalid

◆ GetCellCoordY()

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellCoordY ( int32  CellIndex) const
inline

Convert cell index to coord Y on grid, result can be invalid

◆ GetCellIndex() [1/2]

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellIndex ( const FVector WorldLocation) const
inline

Convert world location to cell index, returns -1 for position outside grid

◆ GetCellIndex() [2/2]

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellIndex ( int32  LocationX,
int32  LocationY 
) const
inline

Convert (X,Y) coords on grid to cell index, returns -1 for position outside grid

◆ GetCellIndexUnsafe() [1/3]

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellIndexUnsafe ( const FIntVector CellCoords) const
inline

Convert (X,Y) coords on grid to cell index, result can be invalid

◆ GetCellIndexUnsafe() [2/3]

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellIndexUnsafe ( const FVector WorldLocation) const
inline

Convert world location to cell index, result can be invalid

◆ GetCellIndexUnsafe() [3/3]

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellIndexUnsafe ( int32  LocationX,
int32  LocationY 
) const
inline

Convert (X,Y) coords on grid to cell index, result can be invalid

◆ GetCellRectangleFromBox()

template<typename CellType , int InvalidCellValue = 0>
FIntRect TSimpleCellGrid< CellType, InvalidCellValue >::GetCellRectangleFromBox ( const FBox WorldBox) const
inline

Compute a rectangle of cells overlapping the given WorldBox.

◆ GetCellsCount()

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::GetCellsCount ( ) const
inline

◆ GetGridRectangle()

template<typename CellType , int InvalidCellValue = 0>
FIntRect TSimpleCellGrid< CellType, InvalidCellValue >::GetGridRectangle ( ) const
inline

Return an IntRect that includes all the cells of the grid. Max is inclusive.

◆ GetWorldCellBox() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FBox TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellBox ( int32  CellIndex) const
inline

Return the bounding box of a cell.

◆ GetWorldCellBox() [2/2]

template<typename CellType , int InvalidCellValue = 0>
FBox TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellBox ( int32  LocationX,
int32  LocationY 
) const
inline

Return the bounding box of a cell.

◆ GetWorldCellBox2D() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FBox2D TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellBox2D ( int32  CellIndex) const
inline

Return the 2D bounding box of a cell.

◆ GetWorldCellBox2D() [2/2]

template<typename CellType , int InvalidCellValue = 0>
FBox2D TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellBox2D ( int32  LocationX,
int32  LocationY 
) const
inline

Return the 2D bounding box of a cell.

◆ GetWorldCellCenter() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FVector TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellCenter ( int32  CellIndex) const
inline

◆ GetWorldCellCenter() [2/2]

template<typename CellType , int InvalidCellValue = 0>
FVector TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellCenter ( int32  LocationX,
int32  LocationY 
) const
inline

◆ GetWorldCellRectangleBox()

template<typename CellType , int InvalidCellValue = 0>
FBox TSimpleCellGrid< CellType, InvalidCellValue >::GetWorldCellRectangleBox ( const FIntRect CellRect) const
inline

Return the world bounding box of all cells included in the given rectangle.

◆ Init() [1/2]

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::Init ( const float  InCellSize,
const FBox Bounds 
)
inline

Initialize the grid from a bounding box

Parameters
InCellSizeSize of a cell
BoundsBounding box the grid needs to encapsulate
Returns
True if the grid was initialized properly

◆ Init() [2/2]

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::Init ( const float  InCellSize,
const FGridSize2D InGridSize,
const FVector InOrigin,
const float  VerticalBoundSize 
)
inline

Initialize the grid

Parameters
InCellSizeSize of a cell
InGridSizeAmount of cells needed in each direction
InOriginWorld location of the grid
VerticalBoundSizeSize of the grid above and under the Origin
Returns
True if the grid was initialized properly

◆ IsValid()

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::IsValid ( ) const
inline

◆ IsValidCoord() [1/2]

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::IsValidCoord ( const FIntVector CellCoords) const
inline

◆ IsValidCoord() [2/2]

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::IsValidCoord ( int32  LocationX,
int32  LocationY 
) const
inline

◆ IsValidIndex()

template<typename CellType , int InvalidCellValue = 0>
bool TSimpleCellGrid< CellType, InvalidCellValue >::IsValidIndex ( const int32  CellIndex) const
inline

◆ Num()

template<typename CellType , int InvalidCellValue = 0>
int32 TSimpleCellGrid< CellType, InvalidCellValue >::Num ( ) const
inline

◆ operator[]() [1/2]

template<typename CellType , int InvalidCellValue = 0>
FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::operator[] ( int32  CellIndex)
inline

◆ operator[]() [2/2]

template<typename CellType , int InvalidCellValue = 0>
const FCellType & TSimpleCellGrid< CellType, InvalidCellValue >::operator[] ( int32  CellIndex) const
inline

◆ Serialize()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::Serialize ( FArchive Ar)
inline

◆ SetVerticalInterval()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::SetVerticalInterval ( const FFloatInterval VerticalInterval)
inline

Change the vertical position of the grid by providing an interval

◆ UpdateWorldBounds()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::UpdateWorldBounds ( )
inline

◆ Zero()

template<typename CellType , int InvalidCellValue = 0>
void TSimpleCellGrid< CellType, InvalidCellValue >::Zero ( )
inline

Member Data Documentation

◆ BoundsSize

template<typename CellType , int InvalidCellValue = 0>
FVector TSimpleCellGrid< CellType, InvalidCellValue >::BoundsSize

◆ Cells

template<typename CellType , int InvalidCellValue = 0>
TArray<FCellType> TSimpleCellGrid< CellType, InvalidCellValue >::Cells
protected

◆ GridCellSize

template<typename CellType , int InvalidCellValue = 0>
float TSimpleCellGrid< CellType, InvalidCellValue >::GridCellSize

◆ GridSize

template<typename CellType , int InvalidCellValue = 0>
FGridSize2D TSimpleCellGrid< CellType, InvalidCellValue >::GridSize

◆ Origin

template<typename CellType , int InvalidCellValue = 0>
FVector TSimpleCellGrid< CellType, InvalidCellValue >::Origin

◆ WorldBounds

template<typename CellType , int InvalidCellValue = 0>
FBox TSimpleCellGrid< CellType, InvalidCellValue >::WorldBounds

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