|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jbox2d.common.MathUtils
public class MathUtils
A few math methods that don't fit very well anywhere else.
Field Summary | |
---|---|
static float |
DEG2RAD
Degrees to radians conversion factor |
static float |
HALF_PI
|
static float |
INV_PI
|
static float |
PI
|
static float |
QUARTER_PI
|
static float |
RAD2DEG
Radians to degrees conversion factor |
static float[] |
sinLUT
|
static float |
THREE_HALVES_PI
|
static float |
TWOPI
|
Constructor Summary | |
---|---|
MathUtils()
|
Method Summary | |
---|---|
static float |
abs(float x)
|
static int |
abs(int x)
|
static float |
atan2(float y,
float x)
|
static int |
ceil(float x)
|
static int |
ceilPowerOf2(int x)
Rounds up the value to the nearest higher power^2 value. |
static float |
clamp(float a,
float low,
float high)
Returns the closest value to 'a' that is in between 'low' and 'high' |
static Vec2 |
clamp(Vec2 a,
Vec2 low,
Vec2 high)
|
static void |
clampToOut(Vec2 a,
Vec2 low,
Vec2 high,
Vec2 dest)
|
static float |
cos(float x)
|
static float |
distance(Vec2 v1,
Vec2 v2)
|
static float |
distanceSquared(Vec2 v1,
Vec2 v2)
|
static float |
fastAtan2(float y,
float x)
|
static float |
fastPow(float a,
float b)
|
static int |
floor(float x)
|
static boolean |
isPowerOfTwo(int x)
|
static float |
map(float val,
float fromMin,
float fromMax,
float toMin,
float toMax)
|
static float |
max(float a,
float b)
|
static int |
max(int a,
int b)
|
static float |
min(float a,
float b)
|
static int |
min(int a,
int b)
|
static int |
nextPowerOfTwo(int x)
Next Largest Power of 2: Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. |
static float |
randomFloat(float argLow,
float argHigh)
|
static float |
randomFloat(Random r,
float argLow,
float argHigh)
|
static float |
reduceAngle(float theta)
|
static int |
round(float x)
|
static float |
sin(float x)
|
static float |
sinLUT(float x)
|
static float |
sqrt(float x)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float PI
public static final float TWOPI
public static final float INV_PI
public static final float HALF_PI
public static final float QUARTER_PI
public static final float THREE_HALVES_PI
public static final float DEG2RAD
public static final float RAD2DEG
public static final float[] sinLUT
Constructor Detail |
---|
public MathUtils()
Method Detail |
---|
public static final float sin(float x)
public static final float sinLUT(float x)
public static final float cos(float x)
public static final float abs(float x)
public static final int abs(int x)
public static final int floor(float x)
public static final int ceil(float x)
public static final int round(float x)
public static final int ceilPowerOf2(int x)
x
-
public static final float max(float a, float b)
public static final int max(int a, int b)
public static final float min(float a, float b)
public static final int min(int a, int b)
public static final float map(float val, float fromMin, float fromMax, float toMin, float toMax)
public static final float clamp(float a, float low, float high)
public static final Vec2 clamp(Vec2 a, Vec2 low, Vec2 high)
public static final void clampToOut(Vec2 a, Vec2 low, Vec2 high, Vec2 dest)
public static final int nextPowerOfTwo(int x)
public static final boolean isPowerOfTwo(int x)
public static final float atan2(float y, float x)
public static final float fastAtan2(float y, float x)
public static final float reduceAngle(float theta)
public static final float randomFloat(float argLow, float argHigh)
public static final float randomFloat(Random r, float argLow, float argHigh)
public static final float sqrt(float x)
public static final float distanceSquared(Vec2 v1, Vec2 v2)
public static final float distance(Vec2 v1, Vec2 v2)
public static final float fastPow(float a, float b)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |