Exemple #1
0
        public BalancedKdTreeNode(T point, Trees.NodeColor color)
        {
            this.Point = point;

            this.Color = color;

            this.LeftChild  = BalancedKdTree <T> .NilNode;
            this.RightChild = BalancedKdTree <T> .NilNode;

            var pointValue = BalancedKdTree <T> .PointFunc(point);

            this.MinimumBoundingBox = new BoundingBox(pointValue.X, pointValue.Y, pointValue.X, pointValue.Y);
        }
Exemple #2
0
        private void RepairBoundingBox()
        {
            var pointValue = BalancedKdTree <T> .PointFunc(Point);

            this.MinimumBoundingBox = new BoundingBox(pointValue.X, pointValue.Y, pointValue.X, pointValue.Y);

            if (LeftChild != null && !LeftChild.IsNilNode())
            {
                this.MinimumBoundingBox = this.MinimumBoundingBox.Add(LeftChild.MinimumBoundingBox);
            }
            if (RightChild != null && !RightChild.IsNilNode())
            {
                this.MinimumBoundingBox = this.MinimumBoundingBox.Add(RightChild.MinimumBoundingBox);
            }

            if (Parent != null)
            {
                Parent.RepairBoundingBox();
            }
        }