Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public void ResetChildren()
 {
     this.FirstChild  = null;
     this.SecondChild = null;
 }
Пример #4
0
 public BSPTree(BSPTree parent, BoundsInt bounds)
 {
     this.Parent = parent;
     this.Bounds = bounds;
 }