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; }
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; }
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(); }
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); } }
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; }
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; }