Exemple #1
0
        private void Subdivide()
        {
            float width  = Boundary.Width * 0.5f;
            float height = Boundary.Height * 0.5f;

            topLeft     = new Quadtree <T>(new RectangleF(Boundary.X, Boundary.Y, width, height), capacity);
            topRight    = new Quadtree <T>(new RectangleF(Boundary.X + width, Boundary.Y, width, height), capacity);
            bottomRight = new Quadtree <T>(new RectangleF(Boundary.X + width, Boundary.Y + height, width, height), capacity);
            bottomLeft  = new Quadtree <T>(new RectangleF(Boundary.X, Boundary.Y + height, width, height), capacity);

            divided = true;
        }
 /// <summary>
 /// Creates an implementation of a <see cref="PartitioningSystem"/> that implements a <see cref="Quadtree{T}"/>.
 /// </summary>
 /// <param name="scene">The scene this system will exist in.</param>
 /// <param name="nodeCapacity">The total amount of entities that exist in a node before overflowing into a new tree.</param>
 /// <param name="targetFPS">The target framerate the system will update in.</param>
 public SQuadtreePartitioner(Scene scene, int nodeCapacity, int targetFPS) : base(scene, targetFPS)
 {
     partitioner = new Quadtree <PartitionerEntry>(scene.SceneBounds, nodeCapacity);
 }
Exemple #3
0
 /// <summary>
 /// Creates an implementation of a <see cref="PartitioningSystem"/> that implements a <see cref="Quadtree{T}"/>.
 /// </summary>
 /// <param name="scene">The scene this system will exist in.</param>
 /// <param name="maximumDimension">The maximum expected size of any entity inserted into the bin.</param>
 /// <param name="targetFPS">The target framerate the system will update in.</param>
 public SBinPartitioner(Scene scene, int maximumDimension, int targetFPS) : base(scene, targetFPS)
 {
     partitioner = new Quadtree <PartitionerEntry>(scene.SceneBounds, maximumDimension);
 }