Esempio n. 1
0
 private QuadTree(double x, double y, double w, double h, QuadTree Root)
     : base(x, y, w, h)
 {
     Objects = new List<ICollidable>();
     Collisions = new PairList<ICollidable>();
     Offset = new Vector2D();
     this.Root = Root;
 }
Esempio n. 2
0
 public QuadTree(double x, double y, double w, double h)
     : base(x, y, w, h)
 {
     Objects = new List<ICollidable>();
     Collisions = new PairList<ICollidable>();
     Offset = new Vector2D();
     Root = this;
 }
Esempio n. 3
0
        public PhysicsEngine()
        {
            QTree = new QuadTree(-100, -100, GameEnvironment.Screen.Width + 200, GameEnvironment.Screen.Height + 200);
            QTree.Split();
            QTree.Split();

            Objects = new List<ICollidable>();
            AccelerationVector = new Vector2D();
        }
Esempio n. 4
0
        public void Split()
        {
            if (Children != null)
                for (int i = 0; i < Children.Length; i++)
                    Children[i].Split();
            else
            {
                double hW = W / 2;
                double hY = H / 2;

                Children = new QuadTree[4];
                Children[0] = new QuadTree(X, Y, hW, hY, Root);
                Children[1] = new QuadTree(X + hW, Y, hW, hY, Root);
                Children[2] = new QuadTree(X, Y + hY, hW, hY, Root);
                Children[3] = new QuadTree(X + hW, Y + hY, hW, hY, Root);

            }
        }
Esempio n. 5
0
 private QuadTree(float x, float y, float w, float h, QuadTree Root)
     : base(x, y, w, h)
 {
     Objects = new List<ICollidable>();
     Collisions = new PairList<ICollidable>();
     Offset = new Vector2D();
     this.Root = Root;
 }
Esempio n. 6
0
 public QuadTree(float x, float y, float w, float h)
     : base(x, y, w, h)
 {
     Objects = new List<ICollidable>();
     Collisions = new PairList<ICollidable>();
     Offset = new Vector2D();
     Root = this;
 }