cs-quad-tree 1.0.1

QuadTree

Install-Package cs-quad-tree -Version 1.0.1
dotnet add package cs-quad-tree --version 1.0.1
<PackageReference Include="cs-quad-tree" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cs-quad-tree --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

cs-quad-tree

QuadTree Implementation

Install

Run the follow nuget command to install:

Install-Package cs-quad-tree 

Usage

The sample code below shows how to use the quad-tree:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace QuadTreeLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();
            QuadTree world = new QuadTree(new Rectangle(0, 0, 2000, 2000));
            
            List<IAgent> population = new List<IAgent>();
            for(int i=0; i < 10000; ++i)
            {
                IAgent agent = new SimpleAgent(world);
                float y = 0; // vertical position
                float x = random.Next(2000);
                float z = random.Next(2000);
                agent.Position = new FVec3(x, y, z);
                population.Add(agent);
            }

            for(int steps = 0; steps < 20; ++steps)
            {
                List<IAgent> agentsWithinRectangle = world.Query(new Rectangle(200, 200, 800, 800));
                Thread.Sleep(100);

                Console.WriteLine("There are {0} agents in rectangel (200, 200, 800, 800) at step {1}",
                    agentsWithinRectangle.Count, steps + 1);

                foreach (IAgent agent in population)
                {
                    float y = 0; // vertical position
                    float x = random.Next(2000);
                    float z = random.Next(2000);
                    agent.Position = new FVec3(x, y, z);
                }
            }
            
        }
    }
}

cs-quad-tree

QuadTree Implementation

Install

Run the follow nuget command to install:

Install-Package cs-quad-tree 

Usage

The sample code below shows how to use the quad-tree:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace QuadTreeLib
{
    class Program
    {
        static void Main(string[] args)
        {
            Random random = new Random();
            QuadTree world = new QuadTree(new Rectangle(0, 0, 2000, 2000));
            
            List<IAgent> population = new List<IAgent>();
            for(int i=0; i < 10000; ++i)
            {
                IAgent agent = new SimpleAgent(world);
                float y = 0; // vertical position
                float x = random.Next(2000);
                float z = random.Next(2000);
                agent.Position = new FVec3(x, y, z);
                population.Add(agent);
            }

            for(int steps = 0; steps < 20; ++steps)
            {
                List<IAgent> agentsWithinRectangle = world.Query(new Rectangle(200, 200, 800, 800));
                Thread.Sleep(100);

                Console.WriteLine("There are {0} agents in rectangel (200, 200, 800, 800) at step {1}",
                    agentsWithinRectangle.Count, steps + 1);

                foreach (IAgent agent in population)
                {
                    float y = 0; // vertical position
                    float x = random.Next(2000);
                    float z = random.Next(2000);
                    agent.Position = new FVec3(x, y, z);
                }
            }
            
        }
    }
}

Release Notes

QuadTree in .NET 4.6.1

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.1 374 4/29/2018