public void ShouldDistanceBeSame() { var distance = VDNHLocation.DistanceTo(HouseLocation); var distance2 = HouseLocation.DistanceTo(VDNHLocation); Assert.AreEqual(distance, distance2, GeoPoint.Epsilon); }
public void Calculation_Fails_GivenGeoPointsWithDifferingReferenceEllipsoids() { GeoPoint p3 = GeoPoint.Parse(0.0, 0.0, Ellipsoid.GRS80); p1.DistanceTo(p3); p3.DistanceTo(p2); }
public void Project_HasToBeChainable() { GeoPoint pointTwo = geoPoint .Project(Distance.Meters(100), Bearing.DecimalDegrees(0)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(90)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(180)) .Project(Distance.Meters(100), Bearing.DecimalDegrees(270)); Assert.IsTrue(pointTwo.DistanceTo(geoPoint).In(MetricUnit.meters) < 0.0015); }
private void SelectClosestRouteStop(GeoPoint location) { var closestStop = _stops.Select(x => x.Model) .Select(x => new Tuple <double, RouteStop>(location.DistanceTo(x.Location.Position), x)) .OrderBy(x => x.Item1) .First(); if (closestStop.Item1 <= MaxDistanceFromBusStop) { var closestRouteStop = closestStop.Item2; this.Dispatcher.RequestMainThreadAction(() => this.SelectRouteStop(closestRouteStop.Id)); } }
private bool CalculateDistance(GeoPoint currentLocation, double maxDistance) { if (currentLocation.IsEmpty) { _distance = 0; DistanceRepr = string.Empty; return(true); } _distance = currentLocation.DistanceTo(_centerStreetPoint); DistanceRepr = GetDistanceRepresentation(_distance); return(!(maxDistance > 0) || _distance <= maxDistance); }
public bool InRange(GeoPoint location, double altitude) { var distance = location.DistanceTo(Location, altitude - Altitude); double elevation; if (location != Location) { elevation = Math.Atan(((altitude - Altitude) / 6076.12) / distance); } else if (altitude < Altitude) { elevation = -90; } else { elevation = 90; } if (distance <= Range && elevation > minel && elevation < maxel && distance < Range) { return(true); } return(false); }
public void Distance_MustBeCommutative() { Assert.AreEqual(p2.DistanceTo(p1), p1.DistanceTo(p2)); }
public void Distance_ReturnsCorrectValues_GivenZeroDistanceInput() { Assert.AreEqual(Distance.Meters(0), p1.DistanceTo(p1)); }
public void DistanceToSelfShouldBeZero() { var gp = new GeoPoint(10, 10); Assert.AreEqual(0D, gp.DistanceTo(gp).Radians, 0.0001); }
private void CalculateDistance(GeoPoint location) { this.DistanceInMeters = Convert.ToInt32(Math.Round(this.Stops.Min(x => location.DistanceTo(x.Location.Position) * 1000))); }
public void Project_ReturnsSaneValues() { GeoPoint p2 = geoPoint.Project(Distance.Meters(300), Bearing.DecimalDegrees(10)); Assert.IsTrue(p2.DistanceTo(GeoPoint.Parse(-33.63364, 151.33240)).In(MetricUnit.meters) < 1); }