Skip to content

Instantly share code, notes, and snippets.

View ngopher's full-sized avatar
🙃

ngh ngopher

🙃
View GitHub Profile
@ngopher
ngopher / HaversinFormula.go
Created December 16, 2017 13:45 — forked from cdipaolo/HaversinFormula.go
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
//