public class MathUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static double |
absClamp(double value,
double bounds)
Clamps a value between -bounds to +bounds.
|
static float |
absClamp(float value,
float bounds)
Clamps a value between -bounds to +bounds.
|
static int |
absClamp(int value,
int bounds)
Clamps a value between -bounds to +bounds.
|
static long |
absClamp(long value,
long bounds)
Clamps a value between -bounds to +bounds.
|
static double |
clamp(double a,
double min,
double max)
Clamps the given number so that
min <= a <= max |
static float |
clamp(float a,
float min,
float max)
Clamps the given number so that
min <= a <= max |
static int |
clamp(int a,
int min,
int max)
Clamps the given number so that
min <= a <= max |
static long |
clamp(long a,
long min,
long max)
Clamps the given number so that
min <= a <= max |
static boolean |
isBetween(double a,
double x,
double b) |
static double |
lerp(double a,
double b,
double f)
Linear interpolates isBetween point a and point b
|
static float |
lerp(float a,
float b,
float f)
Linear interpolates isBetween point a and point b
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
lerp(org.apache.commons.math3.geometry.euclidean.threed.Vector3D a,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D b,
float f)
Linear interpolates isBetween point a and point b
|
static double |
log(double x,
double base) |
static float |
log(float x,
float base) |
static int |
log(int x,
int base) |
static long |
log(long x,
long base) |
static double |
max(double... numbers)
Returns the biggest number contained in the provided array.
|
static double |
max(double a,
double b)
Returns the bigger number of a and b.
|
static double |
max(double a,
double b,
double c)
Returns the bigger number of a, b and c.
|
static float |
max(float... numbers)
Returns the biggest number contained in the provided array.
|
static float |
max(float a,
float b)
Returns the bigger number of a and b.
|
static float |
max(float a,
float b,
float c)
Returns the bigger number of a, b and c.
|
static int |
max(int... numbers)
Returns the biggest number contained in the provided array.
|
static int |
max(int a,
int b)
Returns the bigger number of a and b.
|
static int |
max(int a,
int b,
int c)
Returns the bigger number of a, b and c.
|
static long |
max(long... numbers)
Returns the biggest number contained in the provided array.
|
static long |
max(long a,
long b)
Returns the bigger number of a and b.
|
static long |
max(long a,
long b,
long c)
Returns the bigger number of a, b and c.
|
static double |
min(double... numbers)
Returns the smallest number contained in the provided array.
|
static double |
min(double a,
double b)
Returns the smaller number of a and b.
|
static double |
min(double a,
double b,
double c)
Returns the smaller number of a, b and c.
|
static float |
min(float... numbers)
Returns the smallest number contained in the provided array.
|
static float |
min(float a,
float b)
Returns the smaller number of a and b.
|
static float |
min(float a,
float b,
float c)
Returns the smaller number of a, b and c.
|
static int |
min(int... numbers)
Returns the smallest number contained in the provided array.
|
static int |
min(int a,
int b)
Returns the smaller number of a and b.
|
static int |
min(int a,
int b,
int c)
Returns the smaller number of a, b and c.
|
static long |
min(long... numbers)
Returns the smallest number contained in the provided array.
|
static long |
min(long a,
long b)
Returns the smaller number of a and b.
|
static long |
min(long a,
long b,
long c)
Returns the smaller number of a, b and c.
|
static double |
roundDecimals(double d,
int decimalPlaces)
Rounds a number to a specific number place places
|
static java.lang.String |
toString(double d,
boolean removeTrailingZeroes) |
static double |
truncate(double value,
int truncation) |
public static int min(int a,
int b)
a - value.b - value.public static int min(int a,
int b,
int c)
a - value.b - value.c - value.public static int min(int... numbers)
numbers - Array of numberspublic static int max(int a,
int b)
a - value.b - value.public static int max(int a,
int b,
int c)
a - value.b - value.c - value.public static int max(int... numbers)
numbers - Array of numberspublic static long min(long a,
long b)
a - value.b - value.public static long min(long a,
long b,
long c)
a - value.b - value.c - value.public static long min(long... numbers)
numbers - Array of numberspublic static long max(long a,
long b)
a - value.b - value.public static long max(long a,
long b,
long c)
a - value.b - value.c - value.public static long max(long... numbers)
numbers - Array of numberspublic static double min(double a,
double b)
a - value.b - value.public static double min(double a,
double b,
double c)
a - value.b - value.c - value.public static double min(double... numbers)
numbers - Array of numberspublic static double max(double a,
double b)
a - value.b - value.public static double max(double a,
double b,
double c)
a - value.b - value.c - value.public static double max(double... numbers)
numbers - Array of numberspublic static float min(float a,
float b)
a - value.b - value.public static float min(float a,
float b,
float c)
a - value.b - value.c - value.public static float min(float... numbers)
numbers - Array of numberspublic static float max(float a,
float b)
a - value.b - value.public static float max(float a,
float b,
float c)
a - value.b - value.c - value.public static float max(float... numbers)
numbers - Array of numberspublic static int clamp(int a,
int min,
int max)
min <= a <= maxa - value.min - lower limitmax - upper limitmin <= a <= maxpublic static long clamp(long a,
long min,
long max)
min <= a <= maxa - value.min - lower limitmax - upper limitmin <= a <= maxpublic static double clamp(double a,
double min,
double max)
min <= a <= maxa - valuemin - lower limitmax - upper limitmin <= a <= maxpublic static float clamp(float a,
float min,
float max)
min <= a <= maxa - value.min - lower limitmax - upper limitmin <= a <= maxpublic static double lerp(double a,
double b,
double f)
a - value.b - value.f - A percentage value isBetween 0 to 1public static float lerp(float a,
float b,
float f)
a - value.b - value.f - A percentage value isBetween 0 to 1public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D lerp(org.apache.commons.math3.geometry.euclidean.threed.Vector3D a,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D b,
float f)
a - value.b - value.f - A percentage value isBetween 0 to 1public static int absClamp(int value,
int bounds)
value - The valuebounds - The maximum distance from 0public static long absClamp(long value,
long bounds)
value - The valuebounds - The maximum distance from 0public static double absClamp(double value,
double bounds)
value - The valuebounds - The maximum distance from 0public static float absClamp(float value,
float bounds)
value - The valuebounds - The maximum distance from 0public static double truncate(double value,
int truncation)
public static int log(int x,
int base)
public static long log(long x,
long base)
public static double log(double x,
double base)
public static float log(float x,
float base)
public static boolean isBetween(double a,
double x,
double b)
a - value.x - value.b - value.public static double roundDecimals(double d,
int decimalPlaces)
d - - the numberdecimalPlaces - The decimal placespublic static java.lang.String toString(double d,
boolean removeTrailingZeroes)