UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TQuadTree< ElementType, NodeCapacity > Class Template Reference

#include <GenericQuadTree.h>

Public Member Functions

 TQuadTree ()
 
 TQuadTree (const FBox2D &InBox, float InMinimumQuadSize=100.f)
 
const FBox2DGetTreeBox () const
 
void Insert (const ElementType &Element, const FBox2D &Box, const TCHAR *DebugContext=nullptr)
 
template<typename ElementAllocatorType >
void GetElements (const FBox2D &Box, TArray< ElementType, ElementAllocatorType > &ElementsOut) const
 
template<typename CallbackType >
void GetElements (const FBox2D &Box, CallbackType &&Callback) const
 
bool Remove (const ElementType &Instance, const FBox2D &Box)
 
void Duplicate (TreeType &OutDuplicate) const
 
void Empty ()
 
void Serialize (FArchive &Ar)
 
 TQuadTree (const TQuadTree &)
 
TQuadTreeoperator= (const TQuadTree &Other)
 
 ~TQuadTree ()
 

Constructor & Destructor Documentation

◆ TQuadTree() [1/3]

template<typename ElementType , int32 NodeCapacity>
TQuadTree< ElementType, NodeCapacity >::TQuadTree ( )

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

◆ TQuadTree() [2/3]

template<typename ElementType , int32 NodeCapacity>
TQuadTree< ElementType, NodeCapacity >::TQuadTree ( const FBox2D InBox,
float  InMinimumQuadSize = 100.f 
)

◆ TQuadTree() [3/3]

template<typename ElementType , int32 NodeCapacity>
TQuadTree< ElementType, NodeCapacity >::TQuadTree ( const TQuadTree< ElementType, NodeCapacity > &  Other)

◆ ~TQuadTree()

template<typename ElementType , int32 NodeCapacity>
TQuadTree< ElementType, NodeCapacity >::~TQuadTree ( )

Member Function Documentation

◆ Duplicate()

template<typename ElementType , int32 NodeCapacity>
void TQuadTree< ElementType, NodeCapacity >::Duplicate ( TreeType OutDuplicate) const

Does a deep copy of the tree by going through and re-creating the internal data. Cheaper than re-insertion as it should be linear instead of nlogn

◆ Empty()

template<typename ElementType , int32 NodeCapacity>
void TQuadTree< ElementType, NodeCapacity >::Empty ( )

Removes all elements of the tree

◆ GetElements() [1/2]

template<typename ElementType , int32 NodeCapacity>
template<typename CallbackType >
void TQuadTree< ElementType, NodeCapacity >::GetElements ( const FBox2D Box,
CallbackType &&  Callback 
) const
inline

Given a 2D box, iterates over intersecting elements and execute the callback for each. If Callback returns true, it will continue processing, if it returns false, iteration will end.

◆ GetElements() [2/2]

template<typename ElementType , int32 NodeCapacity>
template<typename ElementAllocatorType >
void TQuadTree< ElementType, NodeCapacity >::GetElements ( const FBox2D Box,
TArray< ElementType, ElementAllocatorType > &  ElementsOut 
) const

Given a 2D box, returns an array of elements within the box. There will not be any duplicates in the list.

◆ GetTreeBox()

template<typename ElementType , int32 NodeCapacity = 4>
const FBox2D & TQuadTree< ElementType, NodeCapacity >::GetTreeBox ( ) const
inline

Gets the TreeBox so systems can test insertions before trying to do so with invalid regions

◆ Insert()

template<typename ElementType , int32 NodeCapacity>
void TQuadTree< ElementType, NodeCapacity >::Insert ( const ElementType &  Element,
const FBox2D Box,
const TCHAR DebugContext = nullptr 
)

Inserts an object of type ElementType with an associated 2D box of size Box (log n). Pass in a DebugContext so when an issue occurs the log can report what requested this insert.

◆ operator=()

template<typename ElementType , int32 NodeCapacity>
TQuadTree< ElementType, NodeCapacity > & TQuadTree< ElementType, NodeCapacity >::operator= ( const TQuadTree< ElementType, NodeCapacity > &  Other)

◆ Remove()

template<typename ElementType , int32 NodeCapacity>
bool TQuadTree< ElementType, NodeCapacity >::Remove ( const ElementType &  Instance,
const FBox2D Box 
)

Removes an object of type ElementType with an associated 2D box of size Box (log n). Does not cleanup tree

◆ Serialize()

template<typename ElementType , int32 NodeCapacity>
void TQuadTree< ElementType, NodeCapacity >::Serialize ( FArchive Ar)

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