public static S1Angle latitude(S2Point p) { // We use atan2 rather than asin because the input vector is not necessarily // unit length, and atan2 is much more accurate than asin near the poles. return S1Angle.radians( Math.atan2(p.get(2), Math.sqrt(p.get(0) * p.get(0) + p.get(1) * p.get(1)))); }
public static S1Angle longitude(S2Point p) { // Note that atan2(0, 0) is defined to be zero. return S1Angle.radians(Math.atan2(p.get(1), p.get(0))); }
/** Return the normalized direction vector corresponding to the center of the given cell. */ public S2Point toPoint() { return S2Point.normalize(toPointRaw()); }