Package com.google.common.geometry
Class Platform
- java.lang.Object
-
- com.google.common.geometry.Platform
-
@GwtCompatible(emulated=true) final class Platform extends java.lang.Object
Contains utility methods which require different GWT client and server implementations. This contains the server side implementations.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Platform()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
doubleHash(double value)
A portable way to hash a double value.(package private) static java.lang.String
formatDouble(double d)
Formats the double as a string and removes unneeded trailing zeros, to behave the same as printf("%.15g",d) in C++.(package private) static java.lang.String
formatString(java.lang.String format, java.lang.Object... params)
ReturnsString.format
with the arguments.(package private) static int
getExponent(double d)
(package private) static java.util.logging.Logger
getLoggerForClass(java.lang.Class<?> clazz)
Returns theLogger
for the class.(package private) static double
IEEEremainder(double f1, double f2)
(package private) static java.math.BigDecimal
newBigDecimal(double x)
Returns a newBigDecimal
instance whose value is the exact decimal representation ofx
, emulating the behavior ofBigDecimal(double)
.static double
nextAfter(double x, double dir)
Returns the next representable value in the direction of 'dir' starting from 'x', emulating the behavior ofMath.nextAfter(double, double)
.(package private) static void
printf(java.io.PrintStream stream, java.lang.String format, java.lang.Object... params)
Invokesstream.printf
with the arguments.static int
sign(S2Point a, S2Point b, S2Point c)
Returns the sign of the determinant of the matrix constructed from the three column vectorsa
,b
, andc
.static double
ulp(double x)
Returns the size of an ulp of the argument.
-
-
-
Method Detail
-
IEEEremainder
static double IEEEremainder(double f1, double f2)
- See Also:
Math.IEEEremainder(double, double)
-
getExponent
static int getExponent(double d)
- See Also:
Math.getExponent(double)
-
getLoggerForClass
static java.util.logging.Logger getLoggerForClass(java.lang.Class<?> clazz)
Returns theLogger
for the class.- See Also:
Logger.getLogger(String)
-
printf
static void printf(java.io.PrintStream stream, java.lang.String format, java.lang.Object... params)
Invokesstream.printf
with the arguments. The GWT client just prints the format string and the arguments separately. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions.
-
formatString
static java.lang.String formatString(java.lang.String format, java.lang.Object... params)
ReturnsString.format
with the arguments. The GWT client just returns a string consisting of the format string with the parameters concatenated to the end of it. Using this method is not recommended; you should instead construct strings with normal string concatenation whenever possible, so it will work the same way in normal Java and GWT client versions.
-
formatDouble
static java.lang.String formatDouble(double d)
Formats the double as a string and removes unneeded trailing zeros, to behave the same as printf("%.15g",d) in C++. The Javascript implementation does NOT have identical behavior.
-
doubleHash
public static long doubleHash(double value)
A portable way to hash a double value.
-
sign
public static int sign(S2Point a, S2Point b, S2Point c)
Returns the sign of the determinant of the matrix constructed from the three column vectorsa
,b
, andc
. This operation is very robust for small determinants, but is extremely slow and should only be used if performance is not a concern or all faster techniques have been exhausted.
-
ulp
public static double ulp(double x)
Returns the size of an ulp of the argument. An ulp of a double value is the positive distance between this floating-point value and the double next larger in magnitude.
-
nextAfter
public static double nextAfter(double x, double dir)
Returns the next representable value in the direction of 'dir' starting from 'x', emulating the behavior ofMath.nextAfter(double, double)
.
-
newBigDecimal
static java.math.BigDecimal newBigDecimal(double x)
Returns a newBigDecimal
instance whose value is the exact decimal representation ofx
, emulating the behavior ofBigDecimal(double)
.
-
-