Auios.QuadTree 1.1.1

dotnet add package Auios.QuadTree --version 1.1.1
NuGet\Install-Package Auios.QuadTree -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Auios.QuadTree" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Auios.QuadTree --version 1.1.1
#r "nuget: Auios.QuadTree, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Auios.QuadTree as a Cake Addin
#addin nuget:?package=Auios.QuadTree&version=1.1.1

// Install Auios.QuadTree as a Cake Tool
#tool nuget:?package=Auios.QuadTree&version=1.1.1

Auios.QuadTree

Logo

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

Demo3

Demo2

Demo1

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 2,510 10/31/2020
1.1.0 374 10/31/2020
1.0.2 344 10/31/2020
1.0.1 386 10/31/2020
1.0.0 400 10/31/2020

1.1.0
* Using Auios.Rectangle
* Can insert collections of objects now
* Made the Area field public
* Constructors get along with Vector2 now
* Small Insertion optimization

1.1.1
* Updated logo