Navigation
API > API/Runtime > API/Runtime/GeometryCore > API/Runtime/GeometryCore/Spatial
Inheritance Hierarchy
- FSparseDynamicPointOctree3
- TDynamicVerticesOctree3
References
| Module | GeometryCore |
| Header | /Engine/Source/Runtime/GeometryCore/Public/Spatial/SparseDynamicPointOctree3.h |
| Include | #include "Spatial/SparseDynamicPointOctree3.h" |
Syntax
class FSparseDynamicPointOctree3
Remarks
FSparseDynamicPointOctree3 sorts Points 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 Points and their bounding-boxes are not stored in the tree. You must have an integer identifier (PointID) for each Point, and call Insert(PointID, BoundingBox). Some query functions will require you to provide a lambda/etc that can be called to retrieve the bounding box for a given PointID.
By default Points are currently inserted at the maximum possible depth, ie smallest cell that will contain them, or MaxTreeDepth.
The octree is dynamic. Points can be removed and re-inserted.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TSparseListSet< int32 > | CellPointLists | ||
| FRefCountVector | CellRefCounts | Reference counts for Cells list. | |
| TDynamicVector< FSparsePointOctreeCell > | Cells | List of cells. Note that some cells may be unused, depending on CellRefCounts | |
| int | MaxPointsPerCell | If using the InsertPoint_DynamicExpand() insertion path, then when a cell gets to this many points, and has depth < MaxTreeDepth, it will be expanded and its points moved down | |
| int | MaxTreeDepth | Points will not be inserted more than this many levels deep from a Root cell | |
| TDynamicVector< uint32 > | PointIDToCellMap | ||
| TSparseGrid3< uint32 > | RootCells | RootCells are the top-level cells of the octree, of size RootDimension. | |
| double | RootDimension | Potential optimizations/improvements |
Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | CellContains
(
const FSparsePointOctreeCell& Cell, |
||
| void | CheckValidity
(
TFunctionRef< bool(int)> IsValidPointIDFunc, |
Check that the octree is internally valid | |
| void | ComputeStatistics
(
FStatistics& StatsOut |
Populate given FStatistics with info about the octree | |
| void | ConfigureFromPointCountEstimate
(
double MaxBoundsDimension, |
Do a rough ballpark configuration of the RootDimension, MaxTreeDepth, and MaxPointsPerCell tree config values, given a bounding-box dimension and estimate of the total number of points that will be inserted. | |
| bool | ContainsPoint
(
int32 PointID |
Test if an Point is stored in the tree | |
| uint32 | CreateNewRootCell
(
FSparsePointOctreeCell NewRootCell, |
||
| FSparsePointOctreeCell | FindCurrentContainingCell
(
const FVector3d& Position |
||
| int32 | FindNearestHitPoint
(
const FRay3d& Ray, |
Find nearest ray-hit point with Points in tree | |
| double | FindNearestRayCellIntersection
(
const FSparsePointOctreeCell& Cell, |
||
| FAxisAlignedBox3d | GetCellBox
(
uint32 Level, |
||
| FAxisAlignedBox3d | GetCellBox
(
const FSparsePointOctreeCell& Cell |
||
| FVector3d | GetCellCenter
(
uint32 Level, |
||
| FVector3d | GetCellCenter
(
const FSparsePointOctreeCell& Cell |
||
| uint32 | GetCellForPoint
(
int32 PointID |
||
| double | GetCellWidth
(
uint32 Level |
Calculate the base width of a cell at a given level | |
| void | Insert_NewChildCell
(
int32 PointID, |
||
| void | Insert_NewRoot
(
int32 PointID, |
||
| void | Insert_ToCell
(
int32 PointID, |
||
| void | InsertPoint
(
int32 PointID, |
Insert PointID into the Octree at maximum depth. | |
| void | InsertPoint_DynamicExpand
(
int32 PointID, |
Insert PointID into the Octree. Dynamically expands cells that have more than MaxPointsPerCell | |
| void | ParallelInsertDensePointSet
(
int32 MaxPointID, |
Insert a set of dense points with IDs in range [0, MaxPointID-1], in parallel. | |
| void | ParallelRangeQuery
(
const FAxisAlignedBox3d& Bounds, |
Collect PointIDs from all the cells with bounding boxes that intersect Bounds, where PredicateFunc passes Query is parallelized across Root cells. | |
| FVector3i | PointToIndex
(
uint32 Level, |
||
| void | RangeQuery
(
const FAxisAlignedBox3d& Bounds, |
Collect PointIDs from all the cells with bounding boxes that intersect Bounds, where PredicateFunc passes | |
| void | ReinsertPoint
(
int32 PointID, |
Update the position of an Point in the octree. This is more efficient than doing a remove+insert | |
| bool | RemovePoint
(
int32 PointID |
Remove a Point from the octree | |
| void | RemovePointUnsafe
(
int32 PointID |
Remove a Point from the octree. | |
| int | ToChildCellIndex
(
const FSparsePointOctreeCell& Cell, |
||
| int | ToChildCellIndex
(
uint32 Level, |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FStatistics | Statistics about internal structure of the octree |
Constants
| Name | Description |
|---|---|
| InvalidCellID | This identifier is used for unknown cells |