BBGamelib.ccUtils.RectIntersection C# (CSharp) Method

RectIntersection() public static method

public static RectIntersection ( Rect a, Rect b ) : Rect
a UnityEngine.Rect
b UnityEngine.Rect
return UnityEngine.Rect
		public static Rect RectIntersection(Rect a, Rect b) {
			float x1 = Math.Max(a.x, b.x);
			float x2 = Math.Min(a.x + a.width, b.x + b.width); 
			float y1 = Math.Max(a.y, b.y);
			float y2 = Math.Min(a.y + a.height, b.y + b.height); 
			
			if (FloatUtils.EB(x2 , x1)
			    && FloatUtils.EB(y2 , y1)) { 
				return new Rect(x1, y1, x2 - x1, y2 - y1);
			}
			return new Rect(0, 0, 0, 0); 
		}