Beta
Static
fromBeta
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 in C++ they do not Normalize.
Static
fromStatic
fromStatic
originBeta
Returns a unique "origin" on the sphere for operations that need a fixed reference point. In particular, this is the "point at infinity" used for point-in-polygon testing (by counting the number of edge crossings).
It should not be a point that is commonly used in edge tests in order to avoid triggering code to handle degenerate cases (this rules out the north and south poles). It should also not be on the boundary of any low-level S2Cell for the same reason.
Beta
vectorBeta
Returns the x dimension value.
Beta
Returns the y dimension value.
Beta
Returns the z dimension value.
Beta
Computes a covering of the Point.
Beta
Returns a Point that is orthogonal to both p and op. This is similar to p.Cross(op) (the true cross product) except that it does a better job of ensuring orthogonality when the Point is nearly parallel to op, it returns a non-zero result even when p == op or p == -op and the result is a Point.
It satisfies the following properties (f == PointCross):
(1) f(p, op) != 0 for all p, op
(2) f(op,p) == -f(p,op) unless p == op or p == -op
(3) f(-p,op) == -f(p,op) unless p == op or p == -op
(4) f(p,-op) == -f(p,op) unless p == op or p == -op
Beta
Reports the angle between two vectors with better precision when the two are nearly parallel.
The .Angle() member function uses atan(|AxB|, A.B) to compute the angle between A and B, which can lose about half its precision when A and B are nearly (anti-)parallel.
Kahan provides a much more stable form:
2*atan2(| A*|B| - |A|*B |, | A*|B| + |A|*B |)
Since Points are unit magnitude by construction we can simplify further:
2*atan2(|A-B|,|A+B|)
This likely can't replace Vectors Angle since it requires four magnitude calculations, each of which takes 5 operations + a square root, plus 6 operations to find the sum and difference of the vectors, for a total of 26 + 4 square roots. Vectors Angle requires 19 + 1 square root.
Since we always have unit vectors, we can elide two of those magnitude calculations for a total of 16 + 2 square roots which is competitive with Vectors Angle performance.
Reference: Kahan, W. (2006, Jan 11). "How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?" (p. 47). https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf
The 2 points must be normalized.
Beta
Returns a string representation of an object.
Static
chordStatic
orderedCCWBeta
Returns true if the edges OA, OB, and OC are encountered in that order while sweeping CCW around the point O.
You can think of this as testing whether A <= B <= C with respect to the CCW ordering around O that starts at A, or equivalently, whether B is contained in the range of angles (inclusive) that starts at A and extends CCW to C. Properties:
(1) If OrderedCCW(a,b,c,o) && OrderedCCW(b,a,c,o), then a == b
(2) If OrderedCCW(a,b,c,o) && OrderedCCW(a,c,b,o), then b == c
(3) If OrderedCCW(a,b,c,o) && OrderedCCW(c,b,a,o), then a == b == c
(4) If a == b or b == c, then OrderedCCW(a,b,c,o) is true
(5) Otherwise if a == c, then OrderedCCW(a,b,c,o) is false
Static
orthoBeta
Returns a unit-length vector that is orthogonal to this point. Satisfies Ortho(-a) = -Ortho(a) for all a.
Note that Vector3 also defines an "Ortho" method, but this one is preferred for use in S2 code because it explicitly tries to avoid result coordinates that are zero. (This is a performance optimization that reduces the amount of time spent in functions that handle degeneracies.)
Static
regularStatic
regularStatic
sort
Point represents a point on the unit sphere as a normalized 3D vector. Fields should be treated as read-only. Use one of the factory methods for creation.
incomplete