Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="items">Partitioning items</param>
        /// <param name="maxDepth">Maximum depth</param>
        public QuadTree(IEnumerable <T> items, int maxDepth)
        {
            var bbox = GeometryUtil.CreateBoundingBox(items);
            var bsph = GeometryUtil.CreateBoundingSphere(items);

            this.BoundingBox    = bbox;
            this.BoundingSphere = bsph;

            int nodeCount = 0;

            this.Root = QuadTreeNode <T> .CreatePartitions(
                this, null,
                bbox, items,
                maxDepth,
                0,
                ref nodeCount);

            this.Root.ConnectNodes();
        }