MCPcopy
hub / github.com/golang/geo / PointFromLatLng

Function PointFromLatLng

s2/latlng.go:85–90  ·  view source on GitHub ↗

PointFromLatLng returns a Point for the given LatLng. The maximum error in the result is 1.5 * machineEpsilon64. (This does not include the error of converting degrees, E5, E6, or E7 into radians.)

(ll LatLng)

Source from the content-addressed store, hash-verified

83// The maximum error in the result is 1.5 * machineEpsilon64. (This does not
84// include the error of converting degrees, E5, E6, or E7 into radians.)
85func PointFromLatLng(ll LatLng) Point {
86 phi := ll.Lat.Radians()
87 theta := ll.Lng.Radians()
88 cosphi := math.Cos(phi)
89 return Point{r3.Vector{X: math.Cos(theta) * cosphi, Y: math.Sin(theta) * cosphi, Z: math.Sin(phi)}}
90}
91
92// LatLngFromPoint returns an LatLng for a given Point.
93func LatLngFromPoint(p Point) LatLng {

Calls 3

RadiansMethod · 0.80
CosMethod · 0.80
SinMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…