/// <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); }
/// <summary> /// Calculates distance between two locations. /// </summary> /// <param name="LocationA">First location.</param> /// <param name="LocationB">Second location.</param> /// <returns>Distance between the two locations in metres.</returns> public static double DistanceBetween(GpsLocation LocationA, GpsLocation LocationB) { return(LocationA.DistanceTo(LocationB)); }