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

Function PointFromCoords

s2/point.go:52–57  ·  view source on GitHub ↗

PointFromCoords creates a new normalized point from coordinates. This always returns a valid point. If the given coordinates can not be normalized the origin point will be returned. This behavior is different from the C++ construction of a S2Point from coordinates (i.e. S2Point(x, y, z)) in that i

(x, y, z float64)

Source from the content-addressed store, hash-verified

50// This behavior is different from the C++ construction of a S2Point from coordinates
51// (i.e. S2Point(x, y, z)) in that in C++ they do not Normalize.
52func PointFromCoords(x, y, z float64) Point {
53 if x == 0 && y == 0 && z == 0 {
54 return OriginPoint()
55 }
56 return Point{r3.Vector{X: x, Y: y, Z: z}.Normalize()}
57}
58
59// OriginPoint returns a unique "origin" on the sphere for operations that need a fixed
60// reference point. In particular, this is the "point at infinity" used for

Callers 15

ExampleLengthFromPointsFunction · 0.92
TestLengthFromPointsFunction · 0.92
TestPolylineBasicsFunction · 0.85
TestPolylineValidateFunction · 0.85
TestPolylineInterpolateFunction · 0.85
vertexChordDist2Method · 0.85
TestEncodeDecodeFunction · 0.85
cap_test.goFile · 0.85

Calls 2

OriginPointFunction · 0.85
NormalizeMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…