Esempio n. 1
0
 /// <summary>
 /// Called once when a map is unloaded.
 /// </summary>
 public override void MapUnloaded()
 {
     _quadTree.Clear();
     _quadPool.PutObject(_quadTree);
     _quadTree = null;
     base.MapUnloaded();
 }
Esempio n. 2
0
        public Test(string name) : base(name)
        {
            Tables   = new List <Table>();
            entities = new List <RelatusObject>();
            Player   = new Player(200, 0);
            entities.Add(Player);

            quad = new Quad(0, 0, WindowManager.PixelWidth * 2, WindowManager.PixelHeight * 2)
            {
                Color = Color.Gray
            };
            quad.ApplyChanges();

            for (int y = 0; y < WindowManager.PixelHeight * 2 / 41; y++)
            {
                for (int x = 0; x < WindowManager.PixelWidth * 2 / 139; x++)
                {
                    if (x % 2 == 0 && y % 3 == 0)
                    {
                        Tables.Add(new Table(139 * x, 41 * y, Tables.Count));
                    }
                }
            }

            TableQuadtree = new Quadtree <Table>(new RectangleF(0, 0, WindowManager.PixelWidth * 2, WindowManager.PixelHeight * 2), 256);

            foreach (Table t in Tables)
            {
                TableQuadtree.Insert(t);
                entities.Add(t);
            }

            entities.Add(new Worker(0, 0, true, true));
        }
        public void AddWhenTimoutAndMultipleObjectsTest()
        {
            var _objects = new Quadtree<object>();
            var _newObject = new object();
            var _newObject2 = new object();

            var _envelope = new Envelope(new Coordinate(1, 1));
            var _envelope2 = new Envelope(new Coordinate(2, 2));

            Parallel.Invoke(
                () =>
                    {
                        _objects.Add(_envelope, _newObject, 100, () => _objects.Remove(_envelope, _newObject));
                        _objects.Add(_envelope2, _newObject2, 500, () => _objects.Remove(_envelope2, _newObject2));
                    },
                () =>
                    {
                        Thread.Sleep(10);

                        Assert.IsTrue(_objects.Contains(_envelope));
                        Assert.IsTrue(_objects.Contains(_envelope2));

                        Thread.Sleep(250);
                    }
                );

            Assert.IsFalse(_objects.Contains(_envelope));
            Assert.IsTrue(_objects.Contains(_envelope2));
        }
Esempio n. 4
0
        public void CheckRecursiveSplits()
        {
            var _NumberOfSplits = 0L;

            var _Quadtree = new Quadtree<Double>(0, 0, 100, 100, MaxNumberOfEmbeddedPixels: 4);
            _Quadtree.OnTreeSplit += (Quadtree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Quadtree.Add(new Pixel<Double>(1, 1));
            _Quadtree.Add(new Pixel<Double>(9, 1));
            _Quadtree.Add(new Pixel<Double>(1, 9));
            _Quadtree.Add(new Pixel<Double>(9, 9));
            _Quadtree.Add(new Pixel<Double>(4, 4));
            _Quadtree.Add(new Pixel<Double>(5, 5));
            _Quadtree.Add(new Pixel<Double>(50, 5));
            _Quadtree.Add(new Pixel<Double>(51, 5));
            _Quadtree.Add(new Pixel<Double>(52, 5));
            _Quadtree.Add(new Pixel<Double>(53, 5));
            _Quadtree.Add(new Pixel<Double>(54, 5));
            _Quadtree.Add(new Pixel<Double>(55, 5));
            _Quadtree.Add(new Pixel<Double>(56, 5));
            _Quadtree.Add(new Pixel<Double>(57, 5));
            _Quadtree.Add(new Pixel<Double>(58, 5));
            _Quadtree.Add(new Pixel<Double>(59, 5));
            _Quadtree.Add(new Pixel<Double>(60, 5));

            Assert.AreEqual(8L, _NumberOfSplits);
        }
Esempio n. 5
0
 public TopologyData()
 {
     GeometryDictionary   = new Dictionary <ObjectId, IGeometry>();
     Quadtree             = new Quadtree <IGeometry>();
     Geometries           = new List <IGeometry>();
     WrongEnvelopeObjects = new HashSet <ObjectId>();
     InvalidObjects       = new HashSet <ObjectId>();
 }
Esempio n. 6
0
        public void ConstructorTest()
        {
            var bounds = new RectangleF(-10f, -15, 20.0f, 30.0f);
            var tree   = new Quadtree(bounds);

            Assert.Equal(bounds, tree.NodeBounds);
            Assert.True(tree.IsLeaf);
        }
Esempio n. 7
0
        private Quadtree MakeTree()
        {
            // Bounds set to ensure actors will fit inside the tree with default bounds.
            var bounds = _quadTreeArea;
            var tree   = new Quadtree(bounds);

            return(tree);
        }
Esempio n. 8
0
 public Quadtree(ReactBox spaceBox, Quadtree parent = null)
 {
     SpaceBox        = spaceBox;
     Parent          = parent;
     HitableCubes    = new List <HitableCube>();
     HitableSpheres  = new List <HitableSphere>();
     HitableCapsules = new List <HitableCapsule>();
 }
Esempio n. 9
0
 public Quadtree(Quadtree NW, Quadtree NE, Quadtree SE, Quadtree SW)
 {
     // Quadtree upper levels (no Elements, only more Quadtrees)
     this.children[0] = NW;
     this.children[1] = NE;
     this.children[2] = SE;
     this.children[3] = SW;
 }
Esempio n. 10
0
        private void Awake()
        {
            var boundaries = new Rect(
                0.0f,
                0.0f,
                2000.0f,
                2000.0f
                );

            var tree = new Quadtree <Vector3>(boundaries);

            var positions = new Vector3[1000000];

            // generate random vectors
            for (var index = 0; index < positions.Length; index++)
            {
                positions[index] = new Vector3(
                    Random.value * 2000.0f,
                    Random.value * 2000.0f,
                    Random.value * 2000.0f
                    );
            }

            // fill tree
            Measure.DebugLogTime("Fill", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var position = positions[index];
                    tree.Insert(position, position);
                }
            });

            // query tree
            Measure.DebugLogTime("Query", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var range = new Rect(
                        Random.value * 2000.0f,
                        Random.value * 2000.0f,
                        10.0f,
                        10.0f
                        );
                    tree.Find(range);
                }
            });

            // empty tree
            Measure.DebugLogTime("Remove", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var position = positions[index];
                    tree.Remove(position, position);
                }
            });
        }
Esempio n. 11
0
        private void Awake()
        {
            var boundaries = new Rect(
                0.0f,
                0.0f,
                2000.0f,
                2000.0f
                );

            var tree = new Quadtree<Vector3>(boundaries);

            var positions = new Vector3[1000000];

            // generate random vectors
            for (var index = 0; index < positions.Length; index++)
            {
                positions[index] = new Vector3(
                    Random.value * 2000.0f,
                    Random.value * 2000.0f,
                    Random.value * 2000.0f
                    );
            }

            // fill tree
            Measure.DebugLogTime("Fill", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var position = positions[index];
                    tree.Insert(position, position);
                }
            });

            // query tree
            Measure.DebugLogTime("Query", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var range = new Rect(
                        Random.value * 2000.0f,
                        Random.value * 2000.0f,
                        10.0f,
                        10.0f
                        );
                    tree.Find(range);
                }
            });

            // empty tree
            Measure.DebugLogTime("Remove", () =>
            {
                for (var index = 0; index < positions.Length; index++)
                {
                    var position = positions[index];
                    tree.Remove(position, position);
                }
            });
        }
        public void Retrieve_Empty_NoResults()
        {
            var treeBounds = Rect.MinMaxRect(-500, -400, 300, 200);
            var tree       = Quadtree <object> .Create(treeBounds, 3, 5);

            var results = tree.Retrieve(GetMinMaxRect(tree, -1, -1, 2, 2));

            Assert.AreEqual(0, results.Count);
        }
Esempio n. 13
0
        public Mesh(float bounds = 1000, int threshold = 10, bool clockwiseWinding = true)
        {
            var bound = new BoundingRectangle(-new Vector2(bounds) / 2, new Vector2(bounds) / 2);

            _vertices  = new Quadtree <Vertex <TVTag, TETag, TFTag> >(bound, threshold);
            _halfEdges = new Quadtree <HalfEdge <TVTag, TETag, TFTag> >(bound, threshold);

            _winding = clockwiseWinding;
        }
Esempio n. 14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            IsMouseVisible = true;

            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth  = 800;
            graphics.ApplyChanges();

            world = new Quadtree <Polygon>(new RectangleF(0, 0, 800, 600));

            poly1 = new Polygon(Vector2.Zero, new List <Vector2>()
            {
                new Vector2(25, 0),
                new Vector2(38, 12),
                new Vector2(25, 38),
                new Vector2(0, 25)
            });

            world.Insert(new Polygon(new Vector2(80, 80), new List <Vector2>()
            {
                new Vector2(50, 50),
                new Vector2(100, 0),
                new Vector2(150, 150)
            }));

            world.Insert(new Polygon(new Vector2(400, 200), new List <Vector2>()
            {
                new Vector2(0, 50),
                new Vector2(50, 0),
                new Vector2(150, 80),
                new Vector2(160, 200),
                new Vector2(-10, 190)
            }));

            world.Insert(ShapePrimitives.Circle(new Vector2(600, 200), 60, 10));
            world.Insert(ShapePrimitives.BezelRectangle(new Vector2(60, 60), new Vector2(160, 220), 15));


            world.Insert(ShapePrimitives.Rectangle(new Vector2(620, 200), new Vector2(660, 230)));

            world.Insert(ShapePrimitives.Rectangle(new Vector2(0, 400), new Vector2(30, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(30, 400), new Vector2(60, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(60, 400), new Vector2(90, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(90, 400), new Vector2(120, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(120, 400), new Vector2(150, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(150, 400), new Vector2(180, 430)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(0, 430), new Vector2(30, 460)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(30, 430), new Vector2(60, 460)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(60, 430), new Vector2(90, 460)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(90, 430), new Vector2(120, 460)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(120, 430), new Vector2(150, 460)));
            world.Insert(ShapePrimitives.Rectangle(new Vector2(150, 430), new Vector2(180, 460)));

            base.Initialize();
        }
Esempio n. 15
0
        public void Node_FindNodeWhichContains_BadArgs()
        {
            var uvs = new List <UV>();

            uvs.Add(UV.ByCoordinates(0, 0));
            uvs.Add(UV.ByCoordinates(0.2, 0.2));
            var qt = Quadtree.ByUVs(uvs);

            Assert.IsNull(qt.Root.FindNodeWhichContains(UV.ByCoordinates(-1, -1)));
        }
Esempio n. 16
0
 public Container(CelestialBodyType type, CelestialBodyIdentifier id, float radius, int randomSeed, float quadtreeRadius, bool root, bool immovable = false) : base(radius, immovable)
 {
     AccessToInitialized = new object();
     Type        = type;
     ID          = id;
     RNG         = new System.Random(randomSeed);
     Quadtree    = new Quadtree(this, quadtreeRadius, -quadtreeRadius, -quadtreeRadius, quadtreeRadius);
     Initialized = false;
     Root        = root;
 }
Esempio n. 17
0
        private void DrawQuadtree <T>(Quadtree <T> quadtree)
        {
            _primitive.DrawBox(quadtree.Boundaries.X, quadtree.Boundaries.Y, quadtree.Boundaries.Width,
                               quadtree.Boundaries.Height, Color.White * 0.5f);

            foreach (var child in quadtree.GetChildren())
            {
                DrawQuadtree(child);
            }
        }
 private void BuildQuadtree()
 {
     _quadtree = new Quadtree();
     for (int i = 0; i < _rings.Count; i++)
     {
         LinearRing ring = (LinearRing)_rings[i];
         Envelope   env  = ring.GetEnvelopeInternal();
         _quadtree.Insert(env, ring);
     }
 }
Esempio n. 19
0
        public void SetRadiusTest()
        {
            Quadtree <Q> quadtree = new Quadtree <Q>(7, Vector2Int.Zero);

            Assert.AreEqual(8, quadtree.Radius);
            quadtree.SetRadius(9);
            Assert.AreEqual(16, quadtree.Radius);
            quadtree.SetRadius(3);
            Assert.AreEqual(4, quadtree.Radius);
        }
Esempio n. 20
0
        private void InitQuadtree()
        {
            // top right, bottom left coords of the camera in world space
            Vector2 topRight   = Camera.main.ViewportToWorldPoint(new Vector2(1, 1));
            Vector2 bottomLeft = Camera.main.ViewportToWorldPoint(new Vector2(0, 0));

            quadtree = new Quadtree(0, new Rectangle(0, 0, width: topRight.x - bottomLeft.x, height: topRight.y - bottomLeft.y));
            // move the camera such that 0,0 is in the bottom left hand corner
            Camera.main.transform.position = new Vector3(quadtree.rect.width * .5f, quadtree.rect.height * .5f);
        }
Esempio n. 21
0
    public MapData()
    {
        instance = this;

        _entityQuadtree          = new Quadtree <Entity>(MAPSIZE);
        _entityCommunicationHash = new RadialSpatialHash <Entity>(COMMUNICATION_BUCKET_SIZE);
        _dirtyChunks             = new Queue <Chunk>();

        PopulateMap();
    }
Esempio n. 22
0
        public void QuadtreeByUVs_GoodArgs()
        {
            var sw = new Stopwatch();

            sw.Start();
            var qt = Quadtree.ByUVs(SetupSampleUVs());

            Assert.NotNull(qt);
            sw.Stop();
            Console.WriteLine("{0} ellapsed for creating quadtree.", sw.Elapsed);
        }
Esempio n. 23
0
 public GameObjectManager(string mediaDir, string shadersDir, CameraFPS camera, TgcD3dInput input, GameSoundManager soundManager)
 {
     MediaDir     = mediaDir;
     ShadersDir   = shadersDir;
     Camera       = camera;
     Input        = input;
     Ray          = new Ray(input);
     QuadTree     = new Quadtree();
     SoundManager = soundManager;
     InitializerObjects();
 }
Esempio n. 24
0
        public void Node_FindAllNodesUpLevel_FromRootNode()
        {
            var uvs = new List <UV>();

            uvs.Add(UV.ByCoordinates(0, 0));
            uvs.Add(UV.ByCoordinates(1, 1));
            var qt       = Quadtree.ByUVs(uvs);
            var nodeList = qt.Root.FindAllNodesUpLevel(3);

            Assert.AreEqual(4, nodeList.Count);
        }
Esempio n. 25
0
        public void InsertAndRemoveNonExistant()
        {
            var quadtree = new Quadtree <MockQuadtreeItem>(new RectangleF(0, 0, 10, 10));

            var item = new MockQuadtreeItem(1, new RectangleF(8, 8, 2, 2));

            quadtree.Insert(item);
            quadtree.Remove(new RectangleF(0, 0, 1, 1));

            Assert.Equal(new[] { item }, quadtree.FindIntersecting(quadtree.Bounds));
        }
Esempio n. 26
0
        public void InsertAndRemove()
        {
            var quadtree = new Quadtree <MockQuadtreeItem>(new RectangleF(0, 0, 10, 10));

            var item = new MockQuadtreeItem(1, new RectangleF(0.5f, 0.5f, 1, 1));

            quadtree.Insert(item);
            quadtree.Remove(item.Bounds);

            Assert.Empty(quadtree.FindIntersecting(quadtree.Bounds));
        }
Esempio n. 27
0
        public void GetIndexTest()
        {
            Quadtree <Q> quadtree = new Quadtree <Q>(8, Vector2Int.Zero);

            Assert.AreEqual((41 << 2), quadtree.GetIndex(new Vector2Int(-2, -7)));
            Assert.AreEqual((41 << 2) + 2, quadtree.GetIndex(new Vector2Int(-2, 6)));
            Assert.AreEqual((41 << 2) + 1, quadtree.GetIndex(new Vector2Int(1, -7)));
            Assert.AreEqual((41 << 2) + 3, quadtree.GetIndex(new Vector2Int(1, 6)));
            Assert.AreEqual((41 << 2) + 3, quadtree.GetIndex(new Vector2Int(9, 6)));
            Assert.AreEqual((41 << 2) + 3, quadtree.GetIndex(new Vector2Int(1, 14)));
        }
Esempio n. 28
0
        public void CreateAndInsertUnderLimit()
        {
            var quadtree = new Quadtree <MockQuadtreeItem>(new RectangleF(0, 0, 100, 100));

            quadtree.Insert(new MockQuadtreeItem(1, new RectangleF(0, 0, 1, 1)));
            quadtree.Insert(new MockQuadtreeItem(2, new RectangleF(1, 1, 2, 2)));

            var allItems = quadtree.FindIntersecting(quadtree.Bounds).ToList();

            Assert.Equal(2, allItems.Count);
        }
Esempio n. 29
0
        public Room(int width, int height)
        {
            Width       = width;
            Height      = height;
            Tiles       = new Tile[width, height];
            RoomBounds  = new Rectangle(0, 0, PixelWidth, PixelHeight);
            entities    = new List <Entity>();
            playerIndex = -1;

            quad = new Quadtree(0, new Rectangle(0, 0, width * Tile.TILE_WIDTH, height * Tile.TILE_HEIGHT));
        }
Esempio n. 30
0
 // Copy constructor
 public Quadtree(Quadtree qt)
 {
     if (qt != null)
     {
         this.children[0] = qt.children[0];
         this.children[1] = qt.children[1];
         this.children[2] = qt.children[2];
         this.children[3] = qt.children[3];
         this.element     = qt.element;
     }
 }
Esempio n. 31
0
        public void IterationSetup()
        {
            _quadtree = new Quadtree <BenchQuadtreeItem>(_bounds);

            foreach (var item in _items)
            {
                _quadtree.Insert(item);
            }

            _movingItems = _movingItemsOriginal.Select(x => x.Clone()).ToArray();
        }
        /// <summary>
        ///
        /// </summary>
        private void BuildQuadtree()
        {
            quadtree = new Quadtree();

            for (int i = 0; i < rings.Count; i++)
            {
                ILinearRing ring = (ILinearRing)rings[i];
                Envelope    env  = (Envelope)ring.EnvelopeInternal;
                quadtree.Insert(env, ring);
            }
        }
Esempio n. 33
0
        public Quadtree <BenchQuadtreeItem> InsertTest()
        {
            var tree = new Quadtree <BenchQuadtreeItem>(_treeBounds);

            foreach (var item in _items)
            {
                tree.Insert(item);
            }

            return(tree);
        }
Esempio n. 34
0
        public Form1()
        {
            InitializeComponent();

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);

            quadtree = new Quadtree<Circle>(10);
            origo = new Point(Width / 2, Height / 2);

            timer = new Timer();
            timer.Tick += new EventHandler(timer_Tick);
            timer.Interval = 1000 / 60;
        }
Esempio n. 35
0
        public void CheckBounds()
        {
            var _Quadtree = new Quadtree<Double>(1, 2, 3, 5);

            Assert.AreEqual(1, _Quadtree.Left);
            Assert.AreEqual(2, _Quadtree.Top);
            Assert.AreEqual(3, _Quadtree.Right);
            Assert.AreEqual(5, _Quadtree.Bottom);
            Assert.AreEqual(2, _Quadtree.Width);
            Assert.AreEqual(3, _Quadtree.Height);

            Assert.AreEqual(0, _Quadtree.EmbeddedCount);
            Assert.AreEqual(0, _Quadtree.Count);
        }
Esempio n. 36
0
        public void DataIsQueriableAsDesired()
        {
            var qtree = new Quadtree<BoundableDummy>();
            var dummy = new BoundableDummy(
                new AxisAlignedBoundingBox2D(10.0f, 10.0f, 20.0f)
                );

            qtree.Add(dummy);
            var searchBox = new AxisAlignedBoundingBox2D(0, 0, 50.0f);
            var hitCount = 0;
            Action<BoundableDummy> hitAction = (BoundableDummy) => hitCount++;

            qtree.Query(searchBox, hitAction);
            Assert.AreEqual(1, hitCount);
        }
Esempio n. 37
0
    // Use this for initialization
    void Start()
    {
        //Service locator needs to know about this object.
        ServiceLocator.Provide(this);

        tree = new Quadtree(new Rect(0, 0, Width, Height));
        generator = new CellularAutomata(Width, Height);
        GenerateLevel();

        if (DEBUGCAMERA)
        {
            Camera.main.gameObject.SetActive(false);

            GameObject.Instantiate(DebugCamera, new Vector3(0, 1, -10), transform.rotation);
        }
    }
        public void AddWhenTimoutNotElapsedTest()
        {
            var _objects = new Quadtree<object>();
            var _newObject = new object();

            var _envelope = new Envelope(new Coordinate(1, 1));

            Parallel.Invoke(
                () => _objects.Add(_envelope, _newObject, 100, () => _objects.Remove(_envelope, _newObject)),
                () =>
                    {
                        Thread.Sleep(10);
                        Assert.IsTrue(_objects.Contains(_envelope));
                    }
                );

            Assert.IsTrue(_objects.Contains(_envelope));
        }
Esempio n. 39
0
        public void QueryQuadtreeWithTwoDummiesAndObtainNone()
        {
            var qtree = new Quadtree<BoundableDummy>();
            var dummy1 = new BoundableDummy(
                new AxisAlignedBoundingBox2D(10.0f, 10.0f, 20.0f)
                );
            var dummy2 = new BoundableDummy(
                new AxisAlignedBoundingBox2D(100.0f, 100.0f, 20.0f)
                );

            qtree.Add(dummy1);
            qtree.Add(dummy2);
            var searchBox = new AxisAlignedBoundingBox2D(50.0f, 50.0f, 5.0f);
            var hitDummies = new List<BoundableDummy>();
            Action<BoundableDummy> hitAction = (bd) => hitDummies.Add(bd);

            qtree.Query(searchBox, hitAction);
            Assert.AreEqual(0, hitDummies.Count);
        }
Esempio n. 40
0
        public void QueryQuadtreeWithThreeDummiesAndObtainAll()
        {
            var qtree = new Quadtree<BoundableDummy>();
            var dummy1 = new BoundableDummy(
                new AxisAlignedBoundingBox2D(10.0f, 10.0f, 20.0f)
                );
            var dummy2 = new BoundableDummy(
                new AxisAlignedBoundingBox2D(100.0f, 100.0f, 20.0f)
                );
            var dummy3 = new BoundableDummy(
                new AxisAlignedBoundingBox2D(10.0f, 60.0f, 20.0f)
                );

            qtree.Add(dummy1);
            qtree.Add(dummy2);
            qtree.Add(dummy3);

            var hitDummies = new List<BoundableDummy>();
            Action<BoundableDummy> hitAction = (bd) => hitDummies.Add(bd);

            qtree.Query(hitAction);
            Assert.AreEqual(3, hitDummies.Count);
        }
Esempio n. 41
0
 protected override void Initialize()
 {
     base.Initialize();
     _tree = new Quadtree<EmptyPoint>(Width / 2, Height / 2, Width / 2, 3);
     UpdateTexture();
 }
 public int CheckCollisions(Quadtree quad)
 {
     List<ICollidable> collidedObjects = GetCollisions(quad);
     return HandleCollisions(collidedObjects);
 }
        public void ContainsWheNotExistsTest()
        {
            var _objects = new Quadtree<object>();
            var _envelope = new Envelope(new Coordinate(1, 1));

            Assert.IsFalse(_objects.Contains(_envelope));
        }
 private static Quadtree<IGeometry> BuildQuadtree(IGeometry geom)
 {
     var index = new Quadtree<IGeometry>();
     geom.Apply(new DelegateGeometryFilter()
     {
         DoFilter = delegate(IGeometry tmpGeometry)
         {
             // only insert atomic geometries
             if (tmpGeometry is IGeometryCollection) return;
             index.Insert(tmpGeometry.EnvelopeInternal, tmpGeometry);
         }
     });
     return index;
 }
        /// <summary>
        /// Checks for collisions with nearby objects and returns list of collided objects.
        /// </summary>
        /// <param name="collidables">A Quadtree off all collidable objects.</param>
        public List<ICollidable> GetCollisions(Quadtree quad)
        {
            List<ICollidable> collidables = quad.SameNodeAs(this);
            List<ICollidable> collidedObjects = new List<ICollidable>();

            foreach (ICollidable obstacle in collidables)
            {
                if (obstacle != null && obstacle.Footprint.Intersects(this.Footprint))
                {
                    collidedObjects.Add(obstacle);
                }
            }

            return collidedObjects;
        }
Esempio n. 46
0
 /// <summary>
 /// Creates new collision manager for region.
 /// </summary>
 public RegionCollision()
 {
     _tree = new Quadtree<LinePath>(new Size(1000, 1000), 2);
     _reference = new Dictionary<long, List<LinePath>>();
 }
 public List<ICollidable> GetCollisions(Rectangle bounds, IEnumerable<ICollidable> collidables)
 {
     Quadtree quad = new Quadtree(0, bounds);
     quad.AddRange(collidables);
     return GetCollisions(quad);
 }
        public void ContainsTest()
        {
            var _objects = new Quadtree<object>();
            var _newObject = new object();

            var _envelope = new Envelope(new Coordinate(1, 1));
            _objects.Add(_envelope, _newObject);

            Assert.IsTrue(_objects.Contains(_envelope));
        }
Esempio n. 49
0
 public void Setup()
 {
     _box = new TwoDimensionalBoundingBox(10, 10, 10);
     _tree = new Quadtree<TestObject>(_box, 2);
 }
Esempio n. 50
0
    /// <summary>
    /// Creates the 4 child nodes.
    /// </summary>
    private void Split()
    {
        //Reset nextIndexForEnemySpawn.
        nextIndexForEnemySpawn = 0;

        //Calculate the half width and half height.
        int hw = (int)(Bounds.width * 0.5f);
        int hh = (int)(Bounds.height * 0.5f);

        int x = (int)Bounds.x;
        int y = (int)Bounds.y;
        int newLevel = level + 1;

        //Create the 4 new nodes.
        nodes[0] = new Quadtree(newLevel, new Rect(
            x, y, hw, hh));
        nodes[1] = new Quadtree(newLevel, new Rect(
            x, y + hh, hw, hh));
        nodes[2] = new Quadtree(newLevel, new Rect(
            x + hw, y + hh, hw, hh));
        nodes[3] = new Quadtree(newLevel, new Rect(
            x + hw, y, hw, hh));
    }
Esempio n. 51
0
 private void DrawQuadTreeNodeBackground(Graphics g, Quadtree<Circle>.Node node, int maxDepth)
 {
     var bb = (BoundingBox)node.bounding;
     Rectangle rect = new Rectangle((int)bb.Minimum.X + origo.X, (int)bb.Minimum.Y + origo.Y, (int)(bb.Maximum.X - bb.Minimum.X), (int)(bb.Maximum.Y - bb.Minimum.Y));
     float diff = bb.Maximum.Z - bb.Minimum.Z;
     if (diff > 0 && (drawLevel == -1 || (maxDepth - drawLevel) == node.DebugReturnDepth))
     {
         diff /= 1.5f;       // height is 0.5f - 1.5f
         int i = 255 - (int)(diff * 255);
         SolidBrush brush = new SolidBrush(Color.FromArgb(i, i, i));
         g.FillRectangle(brush, rect);
         heightCount++;
     }
     foreach (var n in node.DebugReturnChildren)
         if (n != null)
             DrawQuadTreeNodeBackground(g, n, maxDepth);
 }
Esempio n. 52
0
        public void CheckSplit()
        {

            var _NumberOfSplits = 0L;

            var _Quadtree = new Quadtree<Double>(0, 0, 10, 10, MaxNumberOfEmbeddedPixels: 4);
            _Quadtree.OnTreeSplit += (Quadtree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Quadtree.Add(new Pixel<Double>(1, 1));
            Assert.AreEqual(1UL, _Quadtree.EmbeddedCount);
            Assert.AreEqual(1UL, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(9, 1));
            Assert.AreEqual(2, _Quadtree.EmbeddedCount);
            Assert.AreEqual(2, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(1, 9));
            Assert.AreEqual(3, _Quadtree.EmbeddedCount);
            Assert.AreEqual(3, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(9, 9));
            Assert.AreEqual(4, _Quadtree.EmbeddedCount);
            Assert.AreEqual(4, _Quadtree.Count);

            // Add the fifth pixel -> Should cause a split!
            _Quadtree.Add(new Pixel<Double>(4, 4));
            Assert.AreEqual(1L, _NumberOfSplits);

            Assert.AreEqual(0, _Quadtree.EmbeddedCount);
        //    Assert.AreEqual(5, _Quadtree.Count);

        }
Esempio n. 53
0
        private void crearNivel1(  )
        {
            //Construcción del escenario del nivel 1
            int cantVueltas = 1;    //este nivel va tener una vuelta para que se pueda ganar
            TgcBox piso;

            // ----- PÉRGOLA ----- //
            TgcSimpleTerrain terrain;
            string currentHeightmap;
            string currentTexture;
            float currentScaleXZ;
            float currentScaleY;

            //Path de Heightmap default del terreno y Modifier para cambiarla
            currentHeightmap = Shared.mediaPath + "\\otros\\heighmap.jpg";
            currentScaleXZ = 12f;
            currentScaleY = 2.2f;
            currentTexture = Shared.mediaPath + "\\otros\\block02.png";

            //Cargar terreno: cargar heightmap y textura de color
            terrain = new TgcSimpleTerrain();
            terrain.loadHeightmap(currentHeightmap, currentScaleXZ, currentScaleY, new Vector3(0, 0, -300));
            terrain.loadTexture(currentTexture);

            //elementos.Add(hongo);
            List<TgcScene> arboles = EjemploAlumno.getInstance().getArboles();
            float separacionEntreArboles = 0f;
            float inclinacionFila = 0f;
            foreach (TgcScene escenaArbol in arboles)
            {
                TgcMesh arbol = escenaArbol.Meshes[0];
                arbol.Position= new Vector3(600+separacionEntreArboles, 0, 2400+inclinacionFila);
                arbol.Scale = new Vector3(23f, 23f,23f);
                elementos.Add(arbol);
                separacionEntreArboles += 500f;
                inclinacionFila += 60f;
            }

            TgcTexture textura = TgcTexture.createTexture(GuiController.Instance.D3dDevice, GuiController.Instance.AlumnoEjemplosMediaDir + "LosBorbotones\\escenario\\pista3.jpg");
            piso = TgcBox.fromSize(new Vector3(0, 0, 0), new Vector3(15000, 0, 10000), textura); //es un cubo plano con una textura (foto de la pista)

            cielo = new TgcSkyBox(); //Se crea el cielo, es como un cubo grande que envuelve todo y sirve de límite
            cielo.Center = new Vector3(0, 0, 0);
            cielo.Size = new Vector3(20000, 9000, 18000);
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Up, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Down, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Left, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Right, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Front, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.setFaceTexture(TgcSkyBox.SkyFaces.Back, Shared.mediaPath + "\\escenario\\cielo.jpg");
            cielo.updateValues();

            cajas.Add(piso);

            //CARGAR OBSTÁCULOS
            obstaculos.Add(new ObstaculoRigido(-100, 0, -1800, 3700, 300, 80, Shared.mediaPath + "\\otros\\block01.jpg"));
            obstaculos.Add(new ObstaculoRigido(-1300, 0, -100, 80, 300, 3200, Shared.mediaPath + "\\otros\\block01.jpg"));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5650, 0, -3000), new Vector3(15f, 15f, 15f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5500, 0, -3250), new Vector3(10f, 10f, 10f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\columna\\columna-TgcScene.xml", new Vector3(5850, 0, -3000), new Vector3(5f, 5f, 5f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\carnivora\\carnivora-TgcScene.xml", new Vector3(2000, 0, 0), new Vector3(7f, 7f, 7f)));
            ObstaculoRigido p = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\carnivora\\carnivora-TgcScene.xml", new Vector3(2200, 0, 100), new Vector3(5f, 5f, 5f));
            p.mesh.rotateY(0.5f);
            obstaculos.Add(p);

            //guardabarros
            obstaculos.Add(new ObstaculoRigido(7625, -400, 0, 250, 1100, 10000, Shared.mediaPath + "\\otros\\block01.jpg"));
            obstaculos.Add(new ObstaculoRigido(-7625, -400, 0, 250, 1100, 10000, Shared.mediaPath + "\\otros\\block01.jpg"));
            obstaculos.Add(new ObstaculoRigido(0, -400, 5125, 15000, 1100, 250, Shared.mediaPath + "\\otros\\block01.jpg"));
            obstaculos.Add(new ObstaculoRigido(0, -400, -5125, 15000, 1100, 250, Shared.mediaPath + "\\otros\\block01.jpg"));

            //Checkpoints
            for (int m = 0; m < cantVueltas; m++)
            {
                this.PosicionesCheckpoints.Add(new Vector3(5300, -4000, 0));
                this.PosicionesCheckpoints.Add(new Vector3(0, 0, 0));
                this.PosicionesCheckpoints.Add(new Vector3(6000, 2500, 0));
                this.PosicionesCheckpoints.Add(new Vector3(-5000, 4500, 0));
                this.PosicionesCheckpoints.Add(new Vector3(-5000, 1750, 0));
                this.PosicionesCheckpoints.Add(new Vector3(-2500, -500, 0));
                this.PosicionesCheckpoints.Add(new Vector3(-5500, -2500, 0));
                this.PosicionesCheckpoints.Add(new Vector3(-5000, -4500, 0));
                this.PosicionesCheckpoints.Add(new Vector3(0, -2500, 0));
            }

            this.agregarCheckpoints();

            checkpointActual = checkpoints.ElementAt(0);
            checkpointsRestantes = new TgcText2d();
            checkpointsRestantes.Text = checkpoints.Count().ToString();
            checkpointsRestantes.Color = Color.DarkRed;
            checkpointsRestantes.Align = TgcText2d.TextAlign.RIGHT;
            checkpointsRestantes.Position = new Point(630, 30);
            checkpointsRestantes.Size = new Size(100, 50);
            checkpointsRestantes.changeFont(new System.Drawing.Font("TimesNewRoman", 25, FontStyle.Bold));

               ObstaculoRigido hV = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-4300, 0, -300), new Vector3(2f, 2f, 2f));
               hV.mesh.rotateY(0.2f);
            obstaculos.Add(hV);
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-4200, 0, -300), new Vector3(0.5f, 0.5f, 0.5f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-4300, 0, -400), new Vector3(1.2f, 1.2f, 1.2f)));

            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoRojo\\HongoRojo-TgcScene.xml", new Vector3(-5000, 0, 3000), new Vector3(2f, 2f, 2f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-5100, 0, 3000), new Vector3(0.5f, 0.5f, 0.5f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-5100, 0, 3000), new Vector3(1.5f, 1.5f, 1.5f)));
            obstaculos.Add(new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\HongoVerde\\HongoVerde-TgcScene.xml", new Vector3(-4900, 0, 3100), new Vector3(0.2f, 0.2f, 0.2f)));

            ObstaculoRigido b = new ObstaculoRigido(Shared.mediaPath + "\\ambientacion\\bar\\bar-TgcScene.xml", new Vector3(2300, 0, 2600), new Vector3(67f, 15f, 20f));
            obstaculos.Add(b);

            foreach (ObstaculoRigido obstaculo in obstaculos)
            {
                objetos.Add(obstaculo.mesh);
            }
            foreach (TgcMesh elemento in elementos)
            {
                objetos.Add(elemento);
            }
            foreach (Recursos recurso in recursos)
            {
                objetos.Add(recurso.modelo);
            }

            //Crear grilla
            quadtree = new Quadtree();
            quadtree.create(objetos, escenarioBB);
            quadtree.createDebugQuadtreeMeshes();

            GuiController.Instance.Modifiers.addBoolean("showQuadtree", "Show Quadtree", false);

            terrenos.Add(terrain);
        }
Esempio n. 54
0
        public void CheckSplit2()
        {

            var _NumberOfSplits = 0L;

            var _Quadtree = new Quadtree<Double, String>(0, 0, 10, 10, MaxNumberOfEmbeddedPixels: 4);
            _Quadtree.OnTreeSplit += (Quadtree, Pixel) =>
            {
                Interlocked.Increment(ref _NumberOfSplits);
            };

            _Quadtree.Add(new Pixel<Double>(1, 1), "a");
            Assert.AreEqual(1UL, _Quadtree.EmbeddedCount);
            Assert.AreEqual(1UL, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(9, 1), "b");
            Assert.AreEqual(2, _Quadtree.EmbeddedCount);
            Assert.AreEqual(2, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(1, 9), "c");
            Assert.AreEqual(3, _Quadtree.EmbeddedCount);
            Assert.AreEqual(3, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(9, 9), "d");
            Assert.AreEqual(4, _Quadtree.EmbeddedCount);
            Assert.AreEqual(4, _Quadtree.Count);

            // Add the fifth pixel -> Should cause a split!
            _Quadtree.Add(new Pixel<Double>(4, 4), "e");
            Assert.AreEqual(1L, _NumberOfSplits);

            Assert.AreEqual(0, _Quadtree.EmbeddedCount);
            //    Assert.AreEqual(5, _Quadtree.Count);

            _Quadtree.Add(new Pixel<Double>(5, 5), "f");


            var a = _Quadtree.Get(new Rectangle<Double>(3, 3, 6, 6)).ToArray();
            Assert.AreEqual(2, a.Count());
            Assert.IsTrue(a[0].Value == "e" || a[1].Value == "f");

        }
Esempio n. 55
0
        private void DrawQuadTreeNode(Graphics g, Quadtree<Circle>.Node node, int colorIndex, int maxDepth)
        {
            var bb = (BoundingBox)node.bounding;
            Rectangle rect = new Rectangle((int)bb.Minimum.X + origo.X, (int)bb.Minimum.Y + origo.Y, (int)(bb.Maximum.X - bb.Minimum.X), (int)(bb.Maximum.Y - bb.Minimum.Y));
            if (node.objct_to_boundings.Count > 0 && (drawLevel == -1 || (maxDepth-drawLevel) == node.DebugReturnDepth))
            {
                Color color = rightButtonClicked ? Color.Gray : gridColors[colorIndex];

                Pen pen = new Pen(color);
                int minX = System.Math.Max(0, rect.X);
                int minY = System.Math.Max(0, rect.Y);
                int maxX = rect.X + rect.Width;
                int maxY = rect.Y + rect.Height;
                g.DrawLine(pen, new Point(minX, maxY), new Point(maxX, maxY));
                g.DrawLine(pen, new Point(maxX, minY), new Point(maxX, maxY));
                if (rect.X >= 0)
                    g.DrawLine(pen, new Point(minX, minY), new Point(minX, maxY));
                if (rect.Y >= 0)
                    g.DrawLine(pen, new Point(minX, minY), new Point(maxX, minY));

                foreach (Circle c in node.objct_to_boundings.Keys)
                    c.Draw(g, color);
            }

            foreach (var n in node.DebugReturnChildren)
                if (n != null)
                    DrawQuadTreeNode(g, n, colorIndex + 1, maxDepth);
        }
Esempio n. 56
0
        protected override void Initialize()
        {
            mapBounds = new Rectangle(0, 0, graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);
            rand = new Random(this.GetHashCode());

            players = new Player[] {
                new Player(this, PlayerIndex.One, Color.Blue)
            };

            blocks = new Obstacle[] {
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15)),
                new Obstacle(this, new Rectangle(rand.Next(mapBounds.Width),-rand.Next(mapBounds.Height),rand.Next(25,100),rand.Next(25,100)), 0, rand.Next(5,15))
            };

            foreach (Obstacle block in blocks)
            {
                block.DamageType.Add("Collision", new AnimatedSprite.DamageStruct(0, 10));
            }

            foreach(Player player in players)
            {
                player.Status.Invunerable = false;
                player.DamageType.Add("Collision", new AnimatedSprite.DamageStruct(0, 0));
                player.Health.Max = 100;
                player.Health.Current = player.Health.Max;
            }

            _gameState.Current = GameStates.Playing;

            quad = new Quadtree(0, mapBounds);

            base.Initialize();
        }
Esempio n. 57
0
 public void VerifyOutOfBoundsException()
 {
     var _Quadtree = new Quadtree<Double>(1, 2, 3, 5);
     _Quadtree.Add(new Pixel<Double>(10, 10));
 }
Esempio n. 58
0
 public RegionCollision(int x, int y, int width, int height)
 {
     _tree = new Quadtree<LinePath>(new Size(1000, 1000), 2);
 }
        /// <summary>
        /// Caches quick references and initializes the quadtree.
        /// </summary>
        /// <remarks>
        /// This method is invoked by Unity.
        /// </remarks>
        private void Start()
        {
            this.diagonalLengthOver2 = this.DiagonalLength * 0.5f;

            this.terrain = this.GetComponent<Terrain>();
            this.data = terrain.terrainData;

            var boundaries = new Rect(
                this.terrain.transform.position.x,
                this.terrain.transform.position.z,
                this.data.size.x,
                this.data.size.z
                );
            this.trees = new Quadtree<TreeInstance>(boundaries);
            foreach (var instance in this.data.treeInstances)
            {
                this.AddTree(instance);
            }
        }
Esempio n. 60
0
 public QuadtreeNode(int _level, int[] _index, QuadtreeNode _parent, Quadtree _tree) {
     level = _level;
     index = _index;
     parent = _parent;
     tree = _tree;
 }