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


C# Point.DistanceBetween方法代碼示例

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


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

示例1: DistanceBetweenTest1

        public void DistanceBetweenTest1()
        {
            var p1 = new Point (0, 0);
            var p2 = new Point (3, 4);

            var distance = p1.DistanceBetween (p2);
            Assert.AreEqual (distance, 5);
        }
開發者ID:magerate,項目名稱:Geometries,代碼行數:8,代碼來源:PointTests.cs

示例2: DistanceBetweenTest3

        public void DistanceBetweenTest3()
        {
            var p1 = new Point (double.MaxValue, double.MaxValue);
            var p2 = new Point (double.MinValue, double.MinValue);

            var d1 = p1.DistanceBetween (p2);
            var d2 = p2.DistanceBetween (p1);
            Assert.AreEqual (double.PositiveInfinity,d1);
            Assert.AreEqual (double.PositiveInfinity,d2);
        }
開發者ID:magerate,項目名稱:Geometries,代碼行數:10,代碼來源:PointTests.cs

示例3: LineDistanceBetweenTest3

        public void LineDistanceBetweenTest3()
        {
            var p1 = new Point (1, 1);
            var p2 = new Point (1, 1);

            var p3 = new Point (3, 3);

            var distance = Line.DistanceBetween (p1, p2, p3);

            Assert.AreEqual (distance,p1.DistanceBetween(p3));
        }
開發者ID:magerate,項目名稱:Geometries,代碼行數:11,代碼來源:LineTest.cs


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