Choose your operating system:
Windows
macOS
Linux
| FSparseDynamicOctree3
|
Module |
|
Header |
/Engine/Source/Runtime/GeometryCore/Public/Spatial/SparseDynamicOctree3.h |
Include |
#include "Spatial/SparseDynamicOctree3.h" |
class FSparseDynamicOctree3
FSparseDynamicOctree3 sorts objects with axis-aligned bounding boxes into a dynamic sparse octree of axis-aligned uniform grid cells. At the top level we have an infinite grid of "root cells" of size RootDimension, which then contain 8 children, and so on. (So in fact each cell is a separate octree, and we have a uniform grid of octrees)
The objects and their bounding-boxes are not stored in the tree. You must have an integer identifier (ObjectID) for each object, and call Insert(ObjectID, BoundingBox). Some query functions will require you to provide a lambda/etc that can be called to retrieve the bounding box for a given ObjectID.
Objects are currently inserted at the maximum possible depth, ie smallest cell that will contain them, or MaxTreeDepth. The tree boxes are expanded by MaxExpandFactor to allow for deeper insertion. If MaxExpandFactor > 0 then the tree does not strictly partition space, IE adjacent cells overlap.
The octree is dynamic. Objects can be removed and re-inserted.
Name | Description | ||
---|---|---|---|
|
CellObjectLists |
||
|
CellRefCounts |
Reference counts for Cells list. |
|
|
TDynamicVector<... |
Cells |
List of cells. |
|
double |
MaxExpandFactor |
Fraction we expand the dimension of any cell, to allow extra space to fit objects. |
|
int |
MaxTreeDepth |
Objects will not be inserted more than this many levels deep from a Root cell |
|
TDynamicVector<... |
ObjectIDToCellMap |
|
|
TSparseGrid3< u... |
RootCells |
RootCells are the top-level cells of the octree, of size RootDimension. |
|
double |
RootDimension |
Potential optimizations/improvements |
|
SpillObjectSet |
||
|
ValidObjectIDs |
Name | Description | ||
---|---|---|---|
|
BranchRangeQuery ( |
||
|
CanFit ( |
||
|
CheckIfObjectNeedsReinsert ( |
Check if the object needs to be reinserted, if it has NewBounds. |
|
|
CheckValidity ( |
Check that the octree is internally valid |
|
|
ComputeStatistics ( |
Populate given FStatistics with info about the octree |
|
|
ContainmentQuery ( |
Process ObjectIDs from all the cells with bounding boxes that contain query point |
|
|
ContainmentQueryCancellable ( |
Process ObjectIDs from all the cells with bounding boxes that contain query point |
|
|
ContainsObject ( |
Test if an object is stored in the tree |
|
|
FSparseOctre... |
FindCurrentContainingCell ( |
|
|
FindNearestHitObject ( |
Find nearest ray-hit point with objects in tree |
|
|
double |
FindNearestRayCellIntersection ( |
|
|
FAxisAligned... |
GetBox |
|
|
FAxisAligned... |
GetCellBox ( |
|
|
GetCellCenter ( |
||
|
GetCellForObject ( |
||
|
double |
GetCellWidth ( |
Calculate the base width of a cell at a given level |
|
int |
GetMaxTreeDepth() |
|
|
Insert_NewChildCell ( |
||
|
Insert_NewRoot ( |
||
|
Insert_Spill ( |
||
|
Insert_ToCell ( |
||
|
InsertObject ( |
Insert ObjectID into the Octree |
|
|
ParallelRangeQuery ( |
Collect ObjectIDs from all the cells with bounding boxes that intersect Bounds. |
|
|
PointToIndex |
Warning: result here appears to be unstable (due to optimization?) if any of the position values are on the border of a cell (in testing, pragma-optimization-disabled code produced off-by-one result from calling this function) |
|
|
RangeQuery ( |
Process ObjectIDs from all the cells with bounding boxes that intersect Bounds |
|
|
RangeQuery ( |
Collect ObjectIDs from all the cells with bounding boxes that intersect Bounds |
|
|
ReinsertObject ( |
Update the position of an object in the octree. This is more efficient than doing a remove+insert |
|
|
RemoveObject ( |
Remove an object from the octree |
|
|
SetMaxTreeDepth ( |
Sets max tree depth w/ protection against setting beyond supported max |
|
|
int |
ToChildCellIndex ( |
Name |
Description |
|
---|---|---|
|
FStatistics |
Statistics about internal structure of the octree |
Name |
Description |
---|---|
InvalidCellID |
This identifier is used for unknown cells |
MaxSupportedTreeDepth |
|
SpillCellID |
If an object is in the spill cell, that means it didn't fit in the tree |