Auios.QuadTree 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Auios.QuadTree --version 1.0.1                
NuGet\Install-Package Auios.QuadTree -Version 1.0.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.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Auios.QuadTree --version 1.0.1                
#r "nuget: Auios.QuadTree, 1.0.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.0.1

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

Auios.QuadTree

A Generic QuadTree algorithm inspired by Leonidovia's Ultimate QuadTree.

Wikipedia - https://en.wikipedia.org/wiki/Quadtree

Example

// Implement IQuadTreeObjectBounds<T> interface for the object type to be stored
public class MyCustomBounds : IQuadTreeObjectBounds<Vector2>
{
    public float GetLeft(Vecto2 obj)
    {
        return obj.Min(p => p.X);
    }

    public float GetRight(Vector2 obj)
    {
        return obj.Max(p => p.X);
    }

    public float GetTop(Vector2 obj)
    {
        return obj.Min(p => p.Y);
    }

    public float GetBottom(Vector2 obj)
    {
        return obj.Max(p => p.Y);
    }
}

// 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);
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.
  • .NETCoreApp 3.1

    • No dependencies.

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.2.0 210 9/4/2024
1.1.1 3,219 10/31/2020
1.1.0 392 10/31/2020
1.0.2 364 10/31/2020
1.0.1 405 10/31/2020
1.0.0 423 10/31/2020

Field typo fix