public final class MathUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static float |
distance(float aX,
float aY,
float bX,
float bY) |
static float |
distance(int aX,
int aY,
int bX,
int bY) |
static int |
round(float d)
Ends up being a bit faster than
Math.round(float). |
static int |
sum(int[] array) |
public static int round(float d)
Math.round(float). This merely rounds its
argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut
differ slightly from Math.round(float) in that half rounds down for negative
values. -2.5 rounds to -3, not -2. For purposes here it makes no difference.d - real value to roundintpublic static float distance(float aX,
float aY,
float bX,
float bY)
aX - point A x coordinateaY - point A y coordinatebX - point B x coordinatebY - point B y coordinatepublic static float distance(int aX,
int aY,
int bX,
int bY)
aX - point A x coordinateaY - point A y coordinatebX - point B x coordinatebY - point B y coordinatepublic static int sum(int[] array)
array - values to sumCopyright © 2007–2018. All rights reserved.