コード例 #1
0
ファイル: RectangleExtensions.cs プロジェクト: JeroenBos/ASDE
		/// <summary> Returns the parts of a not overlapping with b. </summary>
		public static Rect[] Subtract(Rect a, ref Rect b)
		{
			var legs = a.GetCorners().Count(b.Contains);
			if (legs == 0)
			{
				return a.Substract0Legged(ref b);
			}
			else if (legs == 1)
			{
				return a.Substract1Legged(b);
			}
			else if (legs == 2)
			{
				return a.Substract2Legged(b);
			}
			else
			{
				Contract.Assert(legs == 4);
				return EmptyCollection<Rect>.Array; //rect is already contained in r
			}
		}