C # Calculates the distance between two Mars coordinates (gold or Baidu)

Source: Internet
Author: User
Tags cos sin

/// <summary>        ///get the distance between two coordinates/// </summary>        /// <param name= "LAT1" >The X of the first coordinate</param>        /// <param name= "Lng1" >y of the first coordinate</param>        /// <param name= "LAT2" >The X of the second coordinate</param>        /// <param name= "Lng2" >y of the second coordinate</param>        /// <returns>the distance between two coordinates</returns>         Public Static DoubleGetdistance (DoubleLAT1,DoubleLng1,DoubleLAT2,Doublelng2) {            Try            {                varb = Math.PI/ the; varc = Math.sin ((LAT2-LAT1) * b/2); varD = Math.sin ((lng2-lng1) * b/2); varA = c * C + d * d * MATH.COS (LAT1 * b) * Math.Cos (LAT2 *b); return 12756274* MATH.ATAN2 (Math.sqrt (a), math.sqrt (1-a)); }            Catch(Exception) {return 0; }        }

The above code is stripped from the inside of the German JS.

C # Calculates the distance between two Mars coordinates (gold or Baidu)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.