public double GetVerticalViewAngle(GpsLocation myLoc) { if (VerticalViewAngle == null) { this.VerticalViewAngle = GpsUtils.VerticalAngle(this.Altitude - myLoc.Altitude, Distance.Value); } return(VerticalViewAngle.Value); }
public double QuickDistance(GpsLocation myLoc) { if (Distance == null) { double x1 = Math.PI * (this.Latitude / 360) * 12713500; double x2 = Math.PI * (myLoc.Latitude / 360) * 12713500; double y1 = Math.Cos(this.Latitude * Math.PI / 180) * (this.Longitude / 360) * 40075000; double y2 = Math.Cos(myLoc.Latitude * Math.PI / 180) * (myLoc.Longitude / 360) * 40075000; Distance = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2)); } return(Distance.Value); }
public double QuickBearing(GpsLocation myLoc) { if (Bearing == null) { double myY = Math.PI * (myLoc.Latitude / 360) * 12713500; double otherY = Math.PI * (this.Latitude / 360) * 12713500; double c = Math.Cos(((this.Latitude + myLoc.Latitude) / 2) * Math.PI / 180); double myX = c * (myLoc.Longitude / 360) * 40075000; double otherX = c * (this.Longitude / 360) * 40075000; var dX = otherX - myX; var dY = otherY - myY; //TODO:This can be simplified probably (no if-then-else) double result; if (dX > 0) { if (dY > 0) { var alfa = Rad2Dg(Math.Atan(dX / dY)); result = 0 + alfa; } else { var alfa = Rad2Dg(Math.Atan(dX / -dY)); result = 180 - alfa; } } else { if (dY > 0) { var alfa = Rad2Dg(Math.Atan(-dX / dY)); result = 0 - alfa; } else { var alfa = Rad2Dg(Math.Atan(-dX / -dY)); result = 180 + alfa; } } Bearing = Normalize180(result); } return(Bearing.Value); }
public GpsLocation(GpsLocation gpsLocation) { Longitude = gpsLocation.Longitude; Latitude = gpsLocation.Latitude; Altitude = gpsLocation.Altitude; }