Skip to content

Instantly share code, notes, and snippets.

View jetjokers24895's full-sized avatar

Tạ Công Duy jetjokers24895

  • LixiTech
  • Hồ Chí Mính , Việt Nam
View GitHub Profile
@cdipaolo
cdipaolo / HaversinFormula.go
Created April 15, 2015 01:31
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//