public (BSPTree FirstChild, BSPTree SecondChild) PartitionHorizontal(int partitionPoint) { var leftBounds = this.Bounds; var rightBounds = this.Bounds; leftBounds.xMax = partitionPoint; rightBounds.xMin = partitionPoint; this.FirstChild = new BSPTree(this, leftBounds); this.SecondChild = new BSPTree(this, rightBounds); return(this.FirstChild, this.SecondChild); }
public (BSPTree FirstChild, BSPTree SecondChild) PartitionVertical(int partitionPoint) { var topBounds = this.Bounds; var bottomBounds = this.Bounds; bottomBounds.yMax = partitionPoint; topBounds.yMin = partitionPoint; this.FirstChild = new BSPTree(this, bottomBounds); this.SecondChild = new BSPTree(this, topBounds); return(this.FirstChild, this.SecondChild); }
public void ResetChildren() { this.FirstChild = null; this.SecondChild = null; }
public BSPTree(BSPTree parent, BoundsInt bounds) { this.Parent = parent; this.Bounds = bounds; }