/// <summary> /// Constructs a root node. /// </summary> /// <param name="dimension">Dimension of root quad.</param> /// <param name="maxHeight">Maximum height of node.</param> public QuadNode(int dimension, float maxHeight) { // Store values this.root = this; this.level = 0; this.hasChildren = false; this.maxHeight = maxHeight; this.rectangle = new Rectangle(0, 0, dimension, dimension); this.parent = null; this.children = new QuadNode[4]; // Calculate bounding box this.boundingBox = new BoundingBox( new Vector3(0, -maxHeight, 0), new Vector3(rectangle.Width, maxHeight, rectangle.Height)); // Set transform Vector3 origin = new Vector3(rectangle.X, 0, rectangle.Y); this.matrix = Matrix.CreateTranslation(origin); }