class SpatialTree (Niantic.ARDK.Extensions.Gameboard.SpatialTree)

Overview

class SpatialTree {
public:
    // classes

    class Quad;

    // methods

    void Clear();
    void DrawGizmos(ModelSettings settings);
    bool GetElement(Vector2Int atPosition, out GridNode result);
    bool Insert(IEnumerable<GridNode> gridNodes);
    IEnumerable<GridNode> Query(Bounds withinBounds);
    IEnumerable<GridNode> Query(Vector2Int neighboursTo);
    HashSet<Vector2Int> Remove(IEnumerable<GridNode> gridNodes);
    SpatialTree(int approximateQuadSize);
};

Detailed Documentation

Methods

void DrawGizmos(ModelSettings settings)

Visualizes the quad-tree in the editor's scene view.

Parameters:

setting

The Gameboard's configuration.

bool GetElement(Vector2Int atPosition, out GridNode result)

Returns the grid node at the specified location if exists.

Parameters:

atPosition

The location of the grid node.

result

The element stored at the specified location.

Returns:

True, if the grid node could be located.

bool Insert(IEnumerable<GridNode> gridNodes)

Inserts the provided elements to the tree.

Parameters:

gridNodes

Grid nodes to insert.

Returns:

Whether all nodes were inserted successfully.

HashSet<Vector2Int> Remove(IEnumerable<GridNode> gridNodes)

Removes the provided elements from the tree.

Parameters:

gridNodes

Grid nodes to remove.

SpatialTree(int approximateQuadSize)

Creates a new spatial tree instance. A spatial tree consists of a grid of quads, which themselves can subdivide.

Parameters:

approximateQuadSize

Defines the size of a quad. The actual size will be less than or equal to this number.