當前位置: 首頁>>代碼示例>>C#>>正文


C# BoundingBox.Distance方法代碼示例

本文整理匯總了C#中BoundingBox.Distance方法的典型用法代碼示例。如果您正苦於以下問題:C# BoundingBox.Distance方法的具體用法?C# BoundingBox.Distance怎麽用?C# BoundingBox.Distance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox.Distance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestVarious

		public void TestVarious()
		{
			BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
			Assert.AreEqual(20, b1.Left);
			Assert.AreEqual(20, b1.Min.X);
			Assert.AreEqual(40, b1.Right);
			Assert.AreEqual(40, b1.Max.X);
			Assert.AreEqual(30, b1.Bottom);
			Assert.AreEqual(30, b1.Min.Y);
			Assert.AreEqual(55, b1.Top);
			Assert.AreEqual(55, b1.Max.Y);
			Assert.AreEqual(20, b1.Width);
			Assert.AreEqual(25, b1.Height);
			Assert.AreNotSame(b1, b1.Clone());
			Assert.IsTrue(b1.Contains(new Point(30, 40)));
			Assert.IsTrue(b1.Contains(new Point(20, 40)));
			Assert.IsFalse(b1.Contains(new Point(10, 10)));
			Assert.IsFalse(b1.Contains(new Point(50, 60)));
			Assert.IsFalse(b1.Contains(new Point(30, 60)));
			Assert.IsFalse(b1.Contains(new Point(50, 40)));
			Assert.IsFalse(b1.Contains(new Point(30, 15)));
			Assert.IsTrue(b1.Equals(new BoundingBox(20, 30, 40, 55)));
			Assert.AreEqual(new Point(30, 42.5), b1.GetCentroid());
			Assert.AreEqual(1, b1.LongestAxis);
			Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
			Assert.IsFalse(b1.Equals(null));
			Assert.IsFalse(b1.Equals((object)new Polygon()));
			Assert.AreEqual("20,30 40,55", b1.ToString());
			Assert.AreEqual(b1,new BoundingBox(40,55,20,30));
			Assert.AreEqual(Math.Sqrt(200), b1.Distance(new BoundingBox(50,65,60,75)));
		}
開發者ID:lishxi,項目名稱:_SharpMap,代碼行數:31,代碼來源:BoundingBoxTests.cs

示例2: DistanceTest

		public void DistanceTest()
		{
			BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
			Assert.AreEqual(Math.Sqrt(200), b1.Distance(new BoundingBox(50, 65, 60, 75)));
		}
開發者ID:sridhar19091986,項目名稱:sharpmapcf,代碼行數:5,代碼來源:BoundingBoxTests.cs


注:本文中的BoundingBox.Distance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。