Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21DEC2008  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Returns the mbb of all HyperCubes present in this node.
         *
         * @return A new HyperCube object, representing the mbb of this node.
         */
        public HyperCube GetNodeMbb()
        {
            if (UsedSpace > 0)
            {
                HyperCube[] h = new HyperCube[UsedSpace];
                Array.Copy(Data, 0, h, 0, UsedSpace);
                return(HyperCube.GetUnionMbb(h));
            }
            return(new HyperCube(new Point(new double[] { 0, 0 }),
                                 new Point(new double[] { 0, 0 })));
        }
Ejemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21DEC2008  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Static impementation. Takes an array of HyperCubes and calculates the
         * mbb of their Union.
         *
         * @param  a The array of HyperCubes.
         * @return The mbb of their Union.
         */
        public static HyperCube GetUnionMbb(HyperCube[] a)
        {
            if (a == null || a.Length == 0)
            {
                throw new
                      ArgumentException("HyperCube array is empty.");
            }

            HyperCube h = (HyperCube)a[0].Clone();

            for (int i = 1; i < a.Length; i++)
            {
                h = h.GetUnionMbb(a[i]);
            }

            return(h);
        }