public Rectangle GetInitialBoundingBox() {
     Rectangle bbox = new Rectangle();
     bbox.SetToEmpty();
     foreach (var rect in _fixedRectangles) {
         bbox.Add(rect);
     }
     foreach (var rect in _moveableRectangles) {
         bbox.Add(rect);
     }
     return bbox;
 }
 /// <summary>
 /// intersection (possibly empty) of rectangles
 /// </summary>
 /// <param name="rectangle"></param>
 /// <returns></returns>
 public Rectangle Intersection(Rectangle rectangle)
 {
     Rectangle intersection = new Rectangle();
     if (!Intersects(rectangle))
     {
         intersection.SetToEmpty();
         return intersection;
     }
     double l = Math.Max(Left, rectangle.Left);
     double r = Math.Min(Right, rectangle.Right);
     double b = Math.Max(Bottom, rectangle.Bottom);
     double t = Math.Min(Top, rectangle.Top);
     return new Rectangle(l,b,r,t);
 }
示例#3
0
        public Rectangle GetInitialBoundingBox()
        {
            Rectangle bbox = new Rectangle();

            bbox.SetToEmpty();
            foreach (var rect in _fixedRectangles)
            {
                bbox.Add(rect);
            }
            foreach (var rect in _moveableRectangles)
            {
                bbox.Add(rect);
            }
            return(bbox);
        }
示例#4
0
        /// <summary>
        /// intersection (possibly empty) of rectangles
        /// </summary>
        /// <param name="rectangle"></param>
        /// <returns></returns>
        public Rectangle Intersection(Rectangle rectangle)
        {
            Rectangle intersection = new Rectangle();

            if (!Intersects(rectangle))
            {
                intersection.SetToEmpty();
                return(intersection);
            }
            double l = Math.Max(Left, rectangle.Left);
            double r = Math.Min(Right, rectangle.Right);
            double b = Math.Max(Bottom, rectangle.Bottom);
            double t = Math.Min(Top, rectangle.Top);

            return(new Rectangle(l, b, r, t));
        }
 public Rectangle GetBoundingBox(IEnumerable<TreeNode> nodes)
 {
     Rectangle bbox = new Rectangle();
     bbox.SetToEmpty();
     foreach (var node in nodes)
     {
         bbox.Add(node.rect);
     }
     return bbox;
 }