public class MathHelper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double |
RADIANS_180 |
static double |
RADIANS_270 |
static double |
RADIANS_30 |
static double |
RADIANS_360 |
static double |
RADIANS_45 |
static double |
RADIANS_60 |
static double |
RADIANS_90 |
| Constructor and Description |
|---|
MathHelper() |
| Modifier and Type | Method and Description |
|---|---|
static double |
clamp(double val,
double min,
double max) |
static float |
clamp(float val,
float min,
float max) |
static int |
clamp(int val,
int min,
int max) |
static int |
combination(int n,
int r)
Formula: n!/(r!(n-r)!)
If n is negative, r is negative or r is greater than n 0 will be returned
|
static double |
cosFromSin(double sin,
double angle) |
static double |
distance(double... values)
Distance of N-Dimensional side lengths
|
static int |
factorial(int num)
Returns num!
Negative num values are undefined (1/0), but 0 will be returned instead
|
static double |
getBoundedAngle(double angle)
Ensures the angle is within the range (-RADIANS_180, RADIANS_180]
|
static double |
getHalfway(double start,
double end)
Calculates a 1D position halfway in between a given start and end
|
static float |
getHalfway(float start,
float end)
Calculates a 1D position halfway in between a given start and end
|
static double |
getHalfwayD(Vector2 vec)
Calculates a 1D position halfway in between a given start and end where vec.x is the start and vec.y is the end
|
static float |
getHalfwayF(Vector2 vec)
Calculates a 1D position halfway in between a given start and end where vec.x is the start and vec.y is the end
|
static int |
permutation(int n,
int r)
Formula: n!/(n-r)!
If n is negative, r is negative or r is greater than n 0 will be returned
|
public static final double RADIANS_360
public static final double RADIANS_270
public static final double RADIANS_180
public static final double RADIANS_90
public static final double RADIANS_60
public static final double RADIANS_45
public static final double RADIANS_30
public static double clamp(double val,
double min,
double max)
public static float clamp(float val,
float min,
float max)
public static int clamp(int val,
int min,
int max)
public static int combination(int n,
int r)
public static double cosFromSin(double sin,
double angle)
public static double distance(double... values)
public static int factorial(int num)
public static double getBoundedAngle(double angle)
public static double getHalfwayD(Vector2 vec)
public static float getHalfwayF(Vector2 vec)
public static double getHalfway(double start,
double end)
public static float getHalfway(float start,
float end)
public static int permutation(int n,
int r)