public void Merge(TRectangle rectToMerge) { LeftTop.X = rectToMerge.LeftTop.X < LeftTop.X ? rectToMerge.LeftTop.X : LeftTop.X; LeftTop.Y = rectToMerge.LeftTop.Y < LeftTop.Y ? rectToMerge.LeftTop.Y : LeftTop.Y; RightBottom.X = rectToMerge.RightBottom.X > RightBottom.X ? rectToMerge.RightBottom.X : RightBottom.X; RightBottom.Y = rectToMerge.RightBottom.Y > RightBottom.Y ? rectToMerge.RightBottom.Y : RightBottom.Y; }
public double GetEnlargementArea(TRectangle rectToFit) { return(System.Math.Abs(rectToFit.Area - Area)); }
internal RTreeNode GetMinimumEnlargementArea(TRectangle rect) { return(Children[Children.Take(Children.Count).Select((node, index) => new { node, index }) .OrderBy(x => x.node.Rectangle.GetEnlargementArea(rect)) .ThenBy(x => x.node.Rectangle.Area).First().index]); }