/// <summary> /// Calculates final bearing from the start point to the destination point. /// </summary> /// <param name="Destination">Destination location.</param> /// <returns>Final bearing from the start point to the destination point.</returns> /// <remarks>Formula source: http://www.movable-type.co.uk/scripts/latlong.html .</remarks> public double FinalBearingTo(GpsLocation Destination) { // For final bearing, simply take the initial bearing from the end point to the start point and reverse it (using θ = (θ+180) % 360). double reverseBrng = Destination.InitialBearingTo(this); double res = (reverseBrng + 180.0) % 360.0; return(res); }
/// <summary> /// Basic square constructor. /// </summary> /// <param name="LeftTop">Location of the left-top corner of the square.</param> /// <param name="RightTop">Location of the right-top corner of the square.</param> /// <param name="LeftBottom">Location of the left-bottom corner of the square.</param> /// <param name="RightBottom">Location of the right-bottom corner of the square.</param> public GpsSquare(GpsLocation LeftTop, GpsLocation RightTop, GpsLocation LeftBottom, GpsLocation RightBottom) { this.LeftTop = LeftTop; this.RightTop = RightTop; this.LeftBottom = LeftBottom; this.RightBottom = RightBottom; double bearing = LeftTop.InitialBearingTo(RightTop); double distance = LeftTop.DistanceTo(RightTop) / 2; MidTop = LeftTop.GoVector(bearing, distance); bearing = LeftBottom.InitialBearingTo(RightBottom); distance = LeftBottom.DistanceTo(RightBottom) / 2; MidBottom = LeftBottom.GoVector(bearing, distance); }