A spatial data structure for quick point queries suited for moving or concentrated positions in 2D space. The dense variant uses much more memory, but is slightly faster for insertions and removals than the sparse variant. More...
Public Member Functions | |
void | Clear () |
Clears and resets the tree without deallocating memory. | |
void | Dispose () |
void | DisposeIfCreated () |
float3 | GetBottomLeftPosition () |
bool | GetCell (float3 position, out uint code) |
int2 | GetCellCoordinates (float3 position) |
JobHandle | GetCellsInRadii (NativeArray< float2 > centers, NativeArray< float > radii, ref NativeParallelHashSet< uint > result, JobHandle dependsOn=default, int innerLoopBatchCount=1) |
Calculates a list of cell indices in the tree which are contained within the given circles. | |
JobHandle | GetCellsInRadius (float2 center, float radius, ref NativeList< uint > result, JobHandle dependsOn=default) |
Calculates all the cell indices in the tree which are contained within the given circle. | |
JobHandle | GetCellsInRectangle (Rect rect, ref NativeList< uint > result, JobHandle dependsOn=default) |
Calculates a list of cell indices in the tree which are contained within the given rectangle. | |
JobHandle | GetCellsInRectangles (NativeArray< Rect > rectangles, ref NativeParallelHashSet< uint > result, JobHandle dependsOn=default, int innerLoopBatchCount=1) |
Calculates a list of cell indices in the tree which are contained within the given rectangles. | |
NativeParallelMultiHashMap< uint, T > | GetDataBuckets () |
int | GetMaxDepth () |
NativeList< QuadtreeNode > | GetNodes () |
QuadtreeNode * | GetRoot () |
float2 | GetScale () |
void | Insert (float3 position, T value) |
Inserts a value at a given position into the tree. | |
NativeDenseQuadtree (float3 position, float2 scale, int maxDepth, int capacity, Allocator allocator) | |
NativeDenseQuadtree (Rect bounds, int maxDepth, int capacity, Allocator allocator) | |
bool | Remove (float3 position, T value) |
bool | Update (T value, float3 oldPosition, float3 newPosition) |
![]() |
Properties | |
int | Count [get] |
bool | IsCreated [get] |
![]() |
A spatial data structure for quick point queries suited for moving or concentrated positions in 2D space. The dense variant uses much more memory, but is slightly faster for insertions and removals than the sparse variant.
T |
T | : | unmanaged | |
T | : | IEquatable<T> |
NativeDenseQuadtree | ( | Rect | bounds, |
int | maxDepth, | ||
int | capacity, | ||
Allocator | allocator ) |
bounds | Bounds of the quadtree |
maxDepth | Maximum depth / height of the quadtree - also determines the number of cells |
capacity | |
allocator |
NativeDenseQuadtree | ( | float3 | position, |
float2 | scale, | ||
int | maxDepth, | ||
int | capacity, | ||
Allocator | allocator ) |
position | Center of the quadtree |
scale | The size of the quadtree in meters |
maxDepth | Maximum depth / height of the quadtree - also determines the number of cells |
capacity | |
allocator |
void Clear | ( | ) |
Clears and resets the tree without deallocating memory.
Implements IQuadtree< T >.
float3 GetBottomLeftPosition | ( | ) |
Implements IQuadtree< T >.
bool GetCell | ( | float3 | position, |
out uint | code ) |
position | |
code |
Implements IQuadtree< T >.
int2 GetCellCoordinates | ( | float3 | position | ) |
position |
Implements IQuadtree< T >.
JobHandle GetCellsInRadii | ( | NativeArray< float2 > | centers, |
NativeArray< float > | radii, | ||
ref NativeParallelHashSet< uint > | result, | ||
JobHandle | dependsOn = default, | ||
int | innerLoopBatchCount = 1 ) |
Calculates a list of cell indices in the tree which are contained within the given circles.
center | |
radius | |
result | |
dependsOn |
Implements IQuadtree< T >.
JobHandle GetCellsInRadius | ( | float2 | center, |
float | radius, | ||
ref NativeList< uint > | result, | ||
JobHandle | dependsOn = default ) |
Calculates all the cell indices in the tree which are contained within the given circle.
center | |
radius | |
result | |
dependsOn |
Implements IQuadtree< T >.
JobHandle GetCellsInRectangle | ( | Rect | rect, |
ref NativeList< uint > | result, | ||
JobHandle | dependsOn = default ) |
Calculates a list of cell indices in the tree which are contained within the given rectangle.
rect | |
result | |
dependsOn |
Implements IQuadtree< T >.
JobHandle GetCellsInRectangles | ( | NativeArray< Rect > | rectangles, |
ref NativeParallelHashSet< uint > | result, | ||
JobHandle | dependsOn = default, | ||
int | innerLoopBatchCount = 1 ) |
Calculates a list of cell indices in the tree which are contained within the given rectangles.
rect | |
result | |
dependsOn |
Implements IQuadtree< T >.
NativeParallelMultiHashMap< uint, T > GetDataBuckets | ( | ) |
Implements IQuadtree< T >.
int GetMaxDepth | ( | ) |
Implements IQuadtree< T >.
NativeList< QuadtreeNode > GetNodes | ( | ) |
Implements IQuadtree< T >.
QuadtreeNode * GetRoot | ( | ) |
Implements IQuadtree< T >.
float2 GetScale | ( | ) |
Implements IQuadtree< T >.
void Insert | ( | float3 | position, |
T | value ) |
Inserts a value at a given position into the tree.
position | |
value |
Implements IQuadtree< T >.
bool Remove | ( | float3 | position, |
T | value ) |
position | |
value |
Implements IQuadtree< T >.
bool Update | ( | T | value, |
float3 | oldPosition, | ||
float3 | newPosition ) |
value | |
oldPosition | |
newPosition |
Implements IQuadtree< T >.
|
get |
Implements IQuadtree< T >.
|
get |
Implements IQuadtree< T >.