An open API service indexing awesome lists of open source software.

https://github.com/dli7319/unity-data-structures

A collection of data structures written in C# for Unity
https://github.com/dli7319/unity-data-structures

pm-quadtree unity

Last synced: 2 months ago
JSON representation

A collection of data structures written in C# for Unity

Awesome Lists containing this project

README

          

# unity-data-structures
A collection of data structures for use in Unity.
Written in C#.

## PM Quadtree
-------------------------------------

### Usage
* Copy `PMQuadtree.cs` into your project.
* Use the `PMQuadtree` namespace in the scripts where you need it.
* Create a class implementing `PMQuadtree.HasPosition` or use the included `Point2D` class for a simple map.
* Create a new PM Quadtree by calling `var tree = new PMQuadtree>(minX, minY, maxX, maxY)`
passing in your boundaries.
* Insert elements with `tree.Insert(new Point(1, 1, null))`.

### API
* `bool Insert(T element)`
* Currently always returns true.
* `bool Contains(T element)`
* Returns true if the element is in the tree.
* `bool Remove(T element)`
* Removes the element if it is in the tree.
* Does not throw an exception if the element is not in the tree.
* `bool IsEmpty()`
* `int size`