Auios.QuadTree
1.2.0
dotnet add package Auios.QuadTree --version 1.2.0
NuGet\Install-Package Auios.QuadTree -Version 1.2.0
<PackageReference Include="Auios.QuadTree" Version="1.2.0" />
paket add Auios.QuadTree --version 1.2.0
#r "nuget: Auios.QuadTree, 1.2.0"
// Install Auios.QuadTree as a Cake Addin #addin nuget:?package=Auios.QuadTree&version=1.2.0 // Install Auios.QuadTree as a Cake Tool #tool nuget:?package=Auios.QuadTree&version=1.2.0
Auios.QuadTree
A Generic QuadTree algorithm inspired by Leonidovia's Ultimate QuadTree.
Wikipedia: https://en.wikipedia.org/wiki/Quadtree
Install
NuGet.org: https://www.nuget.org/packages/Auios.QuadTree/
Install-Package Auios.QuadTree
Example
// Implement IQuadTreeObjectBounds<T> interface for the object type to be stored
public class MyCustomBounds : IQuadTreeObjectBounds<Vector2> {
public float GetBottom(Vector2 obj) => obj.Y;
public float GetTop(Vector2 obj) => obj.Y;
public float GetLeft(Vector2 obj) => obj.X;
public float GetRight(Vector2 obj) => obj.X;
}
// Create a QuadTree and fill it with objects
QuadTree<Vector2> quadTree = new QuadTree<Vector2>(800, 600, new MyCustomBounds());
// Generate some data to insert
Random random = new Random();
List<Vector2> myPositions = new List<Vector2>();
for(int i = 0; i < 1000; i++) {
myPositions.Add(new Vector2((float)800 * random.NextDouble(), (float)600 * random.NextDouble()));
}
// Insert data into the QuadTree
foreach(Vector2 position in myPositions) {
quadTree.Insert(myObjects);
}
// Define search area (x, y, width, height)
QuadTreeRect searchArea = new QuadTreeRect(150, 100, 50, 25);
// Find objects in leaf quadrants which overlap the search area
Vector2[] positions = quadTree.FindObjects(searchArea);
Demos
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Auios.Rectangle (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.1.0
* Integrated Auios.Rectangle for improved rectangle handling
* Added support for inserting collections of objects
* Exposed the Area field for greater flexibility
* Enhanced constructors to work seamlessly with Vector2
* Optimized object insertion for better performance
1.1.1
* Refreshed logo for a better look
1.2.0
* Upgraded target framework from netcoreapp3.1 to net8.0