Example #1
0
 public void addEntry(Rectangle r, int id)
 {
     ids[entryCount]     = id;
     entries[entryCount] = r.copy();
     entryCount++;
     if (mbr == null)
     {
         mbr = r.copy();
     }
     else
     {
         mbr.add(r);
     }
 }
Example #2
0
        /// <summary>
        /// Find the the union of this rectangle and the passed rectangle.
        /// Neither rectangle is altered
        /// </summary>
        /// <param name="r">The rectangle to union with this rectangle</param>
        internal Rectangle union(Rectangle r)
        {
            Rectangle union = this.copy();

            union.add(r);
            return(union);
        }
Example #3
0
        /// <summary>
        /// Find the the union of this rectangle and the passed rectangle.
        /// Neither rectangle is altered
        /// </summary>
        /// <param name="r">The rectangle to union with this rectangle</param>
        public Rectangle union(Rectangle r)
        {
            Rectangle union = this.copy();

            union.add(r);
            return(union);
        }
Example #4
0
        /// <summary>
        /// Given a Node<T> object, calculate the Node<T> MBR from it's entries.
        /// Used in consistency checking
        /// </summary>
        private Rectangle calculateMBR(Node <T> n)
        {
            Rectangle mbr = new Rectangle(n.entries[0].min, n.entries[0].max);

            for (int i = 1; i < n.entryCount; i++)
            {
                mbr.add(n.entries[i]);
            }
            return(mbr);
        }