public void AddDeleteBG() { var obj = m_Objects[m_Random.Next(0, m_Objects.Count)]; m_Tree.Remove(obj); m_Tree.Update(); m_Tree.Add(obj); m_Tree.Update(); }
public void Setup() { m_Tree = new BucketGrid <TestObject>(new FloatRect(0, 0, 100, 100), (int)Math.Sqrt(NumBuckets), (int)Math.Sqrt(NumBuckets)); m_Objects = new List <TestObject>(N); for (int i = 0; i < N; i++) { var obj = new TestObject(RandomPosition()); m_Objects.Add(obj); m_Tree.Add(obj); } }
public BucketGridDemo() { m_Bounds = new FloatRect(new Vector2f(0, 0), (Vector2f)Game.Window.Size); m_Grid = new BucketGrid <CircleShape>(m_Bounds, 100, 100); for (var i = 0; i < m_NumCircles; i++) { var pos = GetRandomPos(); var obj = new CircleShape(2f) { FillColor = Color.Blue, Position = pos }; m_TestObjects.Add(obj, RandomVelocity()); m_Grid.Add(obj); } m_Grid.Update(); }