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
- Host: GitHub
- URL: https://github.com/dli7319/unity-data-structures
- Owner: dli7319
- Created: 2019-05-15T15:51:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-17T15:04:24.000Z (almost 7 years ago)
- Last Synced: 2025-01-08T08:38:13.203Z (over 1 year ago)
- Topics: pm-quadtree, unity
- Language: C#
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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`