public class RMMath
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
RMMath.RMFunc
A class used to specify an arbitrary mathematical function.
|
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(double a,
double x,
double y)
Returns whether a real number is between two other numbers.
|
static double |
ceil(double x,
double y)
Truncate x up to the nearest y.
|
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 double |
clamp(double f)
Returns the given float clamped to 1/1000th precision.
|
static float |
clamp(double f,
double min,
double 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 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(double a)
Returns whether a real number is practically zero.
|
static double |
floor(double x,
double y)
Truncate x down to the nearest y.
|
static boolean |
gt(double a,
double b)
Returns whether a real number is practically greater than another.
|
static boolean |
gte(double a,
double b)
Returns whether a real number is practically greater than or equal another.
|
static boolean |
lt(double a,
double b)
Returns whether a real number is practically less than another.
|
static boolean |
lte(double a,
double 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 float |
randomFloat(float aVal)
Returns a random float up to given value.
|
static int |
randomInt()
Returns a random int.
|
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(double 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 java.lang.Number |
subtract(java.lang.Number n1,
java.lang.Number n2)
Returns the difference of the two given Numbers.
|
static double |
trunc(double x,
double y)
Truncate x down to the nearest y.
|
public static boolean equals(double a, double b)
public static boolean equalsZero(double a)
public static boolean gt(double a, double b)
public static boolean gte(double a, double b)
public static boolean lt(double a, double b)
public static boolean lte(double a, double b)
public static boolean between(double a, double x, double y)
public static int sign(double f)
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 double trunc(double x, double y)
public static double floor(double x, double y)
public static double ceil(double x, double y)
public static double clamp(double f)
public static int clamp(int i, int min, int max)
public static float clamp(double f, double min, double 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 java.lang.Number negate(java.lang.Number aNumber)
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 double sin(double anAngle)
public static double cos(double anAngle)
public static int randomInt()
public static float randomFloat(float aVal)