static public void SplitByY(this Rect item, float y, out Rect bottom, out Rect top) { float split = y.Min(item.yMax); bottom = RectExtensions.CreateStrictMinMaxRect(item.min, item.max.GetWithY(split)); top = RectExtensions.CreateStrictMinMaxRect(item.min.GetWithY(split), item.max); }
static public void SplitByX(this Rect item, float x, out Rect left, out Rect right) { float split = x.Min(item.xMax); left = RectExtensions.CreateStrictMinMaxRect(item.min, item.max.GetWithX(split)); right = RectExtensions.CreateStrictMinMaxRect(item.min.GetWithX(split), item.max); }
static public Rect GetEncompassing(this Rect item, Rect rect) { return(RectExtensions.CreateStrictMinMaxRect( item.xMin.Min(rect.xMin), item.yMin.Min(rect.yMin), item.xMax.Max(rect.xMax), item.yMax.Max(rect.yMax) )); }
static public Rect GetAdjusted(this Rect item, float x_min_adjust, float y_min_adjust, float x_max_adjust, float y_max_adjust) { return(RectExtensions.CreateStrictMinMaxRect(item.xMin + x_min_adjust, item.yMin + y_min_adjust, item.xMax + x_max_adjust, item.yMax + y_max_adjust)); }