public class RMMath
extends java.lang.Object
Constructor and Description |
---|
RMMath() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Number |
add(java.lang.Number n1,
java.lang.Number n2)
Returns the sum of the two given Numbers.
|
static boolean |
between(float a,
float x,
float y)
Returns whether a real number is between two other numbers.
|
static double |
clamp_doubleback(double a,
double x,
double y)
Returns the given double clamped between the two values.
|
static double |
clamp_wrap(double a,
double x,
double y)
Returns the given double clamped between the two values (wraps around if out of range).
|
static int |
clamp_wrap(int a,
int x,
int y)
Returns the given double clamped between the two values (wraps around if out of range).
|
static float |
clamp(double d)
Returns the given double clamped to 1/1000th precision.
|
static float |
clamp(float f)
Returns the given float clamped to 1/1000th precision.
|
static float |
clamp(float f,
float min,
float max)
Returns the given double clamped between the two values.
|
static int |
clamp(int i,
int min,
int max)
Returns the given in clamped between the two values.
|
static double |
cos(double anAngle)
Returns the cos of the given angle in degrees.
|
static float |
cos(float anAngle)
Returns the cos of the given angle in degrees.
|
static java.lang.Number |
divide(java.lang.Number n1,
java.lang.Number n2)
Returns the result of dividing n1 by n2.
|
static boolean |
equals(double a,
double b)
Returns whether two real numbers are equal within a small tolerance.
|
static boolean |
equalsZero(float a)
Returns whether a real number is practically zero.
|
static java.util.List |
getIntervalsFor(float maxValue)
Returns well-chosen intervals from zero to a given a value.
|
static java.util.List |
getIntervalsFor(float minValue,
float maxValue)
Return well-chosen intervals given a min/max value.
|
static boolean |
gt(float a,
float b)
Returns whether a real number is practically greater than another.
|
static boolean |
gte(float a,
float b)
Returns whether a real number is practically greater than or equal another.
|
static boolean |
lt(float a,
float b)
Returns whether a real number is practically less than another.
|
static boolean |
lte(float a,
float b)
Returns whether a real number is practically less than or equal another.
|
static double |
mod(double x,
double y)
Returns the given number modulo the second number (mod for floats).
|
static java.lang.Number |
multiply(java.lang.Number n1,
java.lang.Number n2)
Returns the product of the two given Numbers.
|
static java.lang.Number |
negate(java.lang.Number aNumber)
Returns the negative of the given Number.
|
static int |
randomInt()
Returns a random int.
|
static java.lang.Integer |
randomInteger()
Returns a random Integer.
|
static double |
round(double x,
double y)
Returns the given number rounded to the second number (rounding to arbitrary double values).
|
static float |
round(float x,
float y)
Returns the given number rounded to the second number (rounding to arbitrary floating values).
|
static int |
sign(float f)
Returns the sign of a given number (as -1 or 1).
|
static double |
sin(double anAngle)
Returns the sign of the given angle in degrees.
|
static float |
sin(float anAngle)
Returns the sign of the given angle in degrees.
|
static java.lang.Number |
subtract(java.lang.Number n1,
java.lang.Number n2)
Returns the difference of the two given Numbers.
|
static float |
trunc(float x,
float y)
Truncate x down to the nearest y.
|
public static boolean equals(double a, double b)
public static boolean equalsZero(float a)
public static boolean gt(float a, float b)
public static boolean gte(float a, float b)
public static boolean lt(float a, float b)
public static boolean lte(float a, float b)
public static boolean between(float a, float x, float y)
public static int sign(float f)
public static float sin(float anAngle)
public static float cos(float anAngle)
public static double sin(double anAngle)
public static double cos(double anAngle)
public static double mod(double x, double y)
public static float round(float x, float y)
public static double round(double x, double y)
public static java.lang.Number add(java.lang.Number n1, java.lang.Number n2)
public static java.lang.Number subtract(java.lang.Number n1, java.lang.Number n2)
public static java.lang.Number multiply(java.lang.Number n1, java.lang.Number n2)
public static java.lang.Number divide(java.lang.Number n1, java.lang.Number n2)
public static java.lang.Number negate(java.lang.Number aNumber)
public static float trunc(float x, float y)
public static float clamp(float f)
public static float clamp(double d)
public static int clamp(int i, int min, int max)
public static float clamp(float f, float min, float max)
public static int clamp_wrap(int a, int x, int y)
public static double clamp_wrap(double a, double x, double y)
public static double clamp_doubleback(double a, double x, double y)
public static int randomInt()
public static java.lang.Integer randomInteger()
public static java.util.List getIntervalsFor(float minValue, float maxValue)
public static java.util.List getIntervalsFor(float maxValue)