clone of https://code.google.com/p/s2-geometry-library-java/