|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.maryanovsky.gwtutils.client.MathUtils
public class MathUtils
Mathematical utilities.
Field Summary | |
---|---|
static double |
DEG_TO_RAD
Coefficient for converting degrees to radians. |
protected static int[] |
POWERS_OF_TWO
Powers of two. |
static double |
RAD_TO_DEG
Coefficient for converting radians to degrees. |
Constructor Summary | |
---|---|
MathUtils()
|
Method Summary | |
---|---|
static double |
atan2(double dy,
double dx)
Returns the angle component of the polar coordinates of the specified cartesian coordinates (for some reason, there's no atan2 method in GWT's java.lang.Math ). |
static String |
doubleToFixedString(double number,
int precision)
Returns a string representation of the specified double, with the specified number of digits following the decimal point. |
static int |
getPowerOfTwo(int n)
Returns 2^n, for values of n between 0 and 31. |
static double |
log2(double x)
Returns the logarithm of x, base-2. |
static int |
max(int value0,
int... values)
Returns the maximum of the specified values. |
static int |
min(int value0,
int... values)
Returns the minimum of the specified values. |
static int |
roundDownToMultiple(int value,
int factor)
Returns the largest integer smaller or equal to the specified one which is a multiple of the specified factor. |
static int |
roundUpToMultiple(int value,
int factor)
Returns the smallest integer larger or equal to the specified one, which is a multiple of the specified factor. |
static int |
sgn(int n)
Returns the sign of the specified number, that is -1 if it is negative, 0 if it is zero and 1 if it positive. |
static double |
sqr(double x)
The square function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEG_TO_RAD
public static final double RAD_TO_DEG
protected static final int[] POWERS_OF_TWO
Constructor Detail |
---|
public MathUtils()
Method Detail |
---|
public static int roundDownToMultiple(int value, int factor)
public static int roundUpToMultiple(int value, int factor)
public static String doubleToFixedString(double number, int precision)
public static int getPowerOfTwo(int n)
public static int sgn(int n)
public static double sqr(double x)
public static double atan2(double dy, double dx)
java.lang.Math
).
public static int max(int value0, int... values)
public static int min(int value0, int... values)
public static double log2(double x)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |