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)
| 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. |
| 52 | func 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 |
searching dependent graphs…