Package com.google.common.geometry
Class S2PointCompression
- java.lang.Object
-
- com.google.common.geometry.S2PointCompression
-
@GwtCompatible public final class S2PointCompression extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
S2PointCompression.FaceRunCoder
(package private) static class
S2PointCompression.NthDerivativeCoder
-
Field Summary
Fields Modifier and Type Field Description private static int
DERIVATIVE_ENCODING_ORDER
-
Constructor Summary
Constructors Modifier Constructor Description private
S2PointCompression()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.util.List<S2Point>
decodePointsCompressed(int numVertices, int level, LittleEndianInput decoder)
static java.util.List<S2Point>
decodePointsCompressed(int numVertices, int level, java.io.InputStream input)
Decode a list of points that were encoded usingencodePointsCompressed(java.util.List<com.google.common.geometry.S2Point>, int, java.io.OutputStream)
.(package private) static void
encodePointsCompressed(java.util.List<S2Point> points, int level, LittleEndianOutput encoder)
static void
encodePointsCompressed(java.util.List<S2Point> points, int level, java.io.OutputStream output)
Encode a list of points into an efficient, lossless binary representation, which can be decoded by callingdecodePointsCompressed(int, int, java.io.InputStream)
.private static S2Point
facePiQiToXyz(int face, int pi, int qi, int level)
private static double
piQiToST(int pi, int level)
private static int
siTiToPiQi(long si, int level)
-
-
-
Field Detail
-
DERIVATIVE_ENCODING_ORDER
private static final int DERIVATIVE_ENCODING_ORDER
- See Also:
- Constant Field Values
-
-
Method Detail
-
encodePointsCompressed
public static void encodePointsCompressed(java.util.List<S2Point> points, int level, java.io.OutputStream output) throws java.io.IOException
Encode a list of points into an efficient, lossless binary representation, which can be decoded by callingdecodePointsCompressed(int, int, java.io.InputStream)
. The encoding is byte-compatible with the C++ version of the S2 library.Points that are snapped to the specified level will require approximately 4 bytes per point, while other points will require 24 bytes per point.
- Parameters:
points
- The list of points to encode.level
- TheS2Cell
level at which points should be encoded.output
- The output stream into which the encoding should be written.- Throws:
java.io.IOException
- if there was a problem writing into the output stream.
-
encodePointsCompressed
static void encodePointsCompressed(java.util.List<S2Point> points, int level, LittleEndianOutput encoder) throws java.io.IOException
- Throws:
java.io.IOException
-
decodePointsCompressed
public static java.util.List<S2Point> decodePointsCompressed(int numVertices, int level, java.io.InputStream input) throws java.io.IOException
Decode a list of points that were encoded usingencodePointsCompressed(java.util.List<com.google.common.geometry.S2Point>, int, java.io.OutputStream)
.Points that are snapped to the specified level will require approximately 4 bytes per point, while other points will require 24 bytes per point.
- Parameters:
numVertices
- The number of points to decode.level
- TheS2Cell
level at which points are encoded.input
- The input stream containing the encoded point data.- Returns:
- the list of decoded points.
- Throws:
java.io.IOException
- if there was a problem reading from the input stream.
-
decodePointsCompressed
static java.util.List<S2Point> decodePointsCompressed(int numVertices, int level, LittleEndianInput decoder) throws java.io.IOException
- Throws:
java.io.IOException
-
siTiToPiQi
private static int siTiToPiQi(long si, int level)
-
piQiToST
private static double piQiToST(int pi, int level)
-
facePiQiToXyz
private static S2Point facePiQiToXyz(int face, int pi, int qi, int level)
-
-