本文整理汇总了C#中Position.DistanceFrom方法的典型用法代码示例。如果您正苦于以下问题:C# Position.DistanceFrom方法的具体用法?C# Position.DistanceFrom怎么用?C# Position.DistanceFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.DistanceFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDistanceCloseUp
public void TestDistanceCloseUp()
{
Angle lat1 = new Angle(53, 8, 50);
Angle long1 = new Angle(1, 50, 58);
Position p1 = new Position(new Longitude(long1, CardinalDirection.West), new Latitude(lat1, CardinalDirection.North));
Angle lat2 = new Angle(53, 8, 50);
Angle long2 = new Angle(1, 50, 59);
Position p2 = new Position(new Longitude(long2, CardinalDirection.West), new Latitude(lat2, CardinalDirection.North));
Assert.AreEqual(18.51255400844088,p1.DistanceFrom(p2),.5);
}
示例2: TestDistance
public void TestDistance()
{
//Test case from: http://www.movable-type.co.uk/scripts/latlong.html
Angle lat1 = new Angle(53,8,50);
Angle long1 = new Angle(1,50,58);
Position p1 = new Position(new Longitude(long1,CardinalDirection.West), new Latitude(lat1,CardinalDirection.North));
Angle lat2 = new Angle(52, 12, 16);
Angle long2 = new Angle(0, 8 , 26);
Position p2 = new Position(new Longitude(long2,CardinalDirection.East), new Latitude(lat2, CardinalDirection.North));
Assert.AreEqual(170300.0,p1.DistanceFrom(p2),47);
}