本文整理匯總了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);
}
示例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);
}
示例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));
}