public final class UtilMath
extends java.lang.Object
Math
classModifier and Type | Field and Description |
---|---|
static double |
EPSILON
Epsilon
|
static double |
PI_2
PI / 2
|
static double |
TWO_PI
2 * PI
|
Modifier | Constructor and Description |
---|---|
private |
UtilMath()
To avoid instance
|
Modifier and Type | Method and Description |
---|---|
static double |
Bernouilli(int n,
int m,
double t)
Compute the Bernouilli value
|
static long |
C(int n,
int m)
Compute the combination of N elements in M
|
static boolean |
equals(double real1,
double real2)
Indicates if 2 double are equal
|
static long |
factorial(int integer)
Compute the factorial of an integer
|
static int |
greaterCommonDivisor(int integer1,
int integer2)
Compute the Greater Common Divisor of two integers.
|
static double |
interpolationExponential(double t)
Compute exponential interpolation.
|
static double |
interpolationLogarithm(double t)
Compute logarithm interpolation.
|
static double |
interpolationSinus(double t)
Compute sinus interpolation.
|
static boolean |
isNul(double real)
Indicates if a double is zero
|
static int |
limit0_255(int integer)
Return the given integer, if the integer is in [0, 255].
|
static int |
lowerCommonMultiple(int integer1,
int integer2)
Compute the Lower Common Multiple of two integers.
|
static double |
max(double... doubles)
Maximum of several double
|
static int |
maxIntegers(int... integers)
Maximum of several integers
|
static double |
min(double... doubles)
Minimum of several double
|
static int |
minIntegers(int... integers)
Minimum of several integers
|
static double |
modulo(double real,
double modulo)
Compute the modulo of a real
|
static int |
modulo(int integer,
int modulo)
Mathematical modulo.
|
static long |
modulo(long integer,
long modulo)
Mathematical modulo.
|
static double |
moduloInterval(double real,
double min,
double max)
Modulate a real inside an interval
|
static double |
PCubique(double cp,
double p1,
double p2,
double p3,
double t)
Compute the cubic interpolation
|
static double[] |
PCubiques(double cp,
double p1,
double p2,
double p3,
int precision,
double[] cub)
Compute several cubic interpolation
|
static long |
pow(long integer,
long pow)
Power of integer, more fast than
Math.pow(double, double) for some case. |
static double |
PQuadrique(double cp,
double p1,
double p2,
double t)
Compute the quadric interpolation
|
static double[] |
PQuadriques(double cp,
double p1,
double p2,
int precision,
double[] quad)
Compute several quadric interpolation
|
static int |
sign(double real)
Sign of a double.
|
static int |
sign(int integer)
Sign of an integer.
|
static int |
sign(long integer)
Sign of an integer.
|
public static final double EPSILON
public static double PI_2
public static double TWO_PI
public static double Bernouilli(int n, int m, double t)
n
- Number of elementsm
- Total of elementst
- Factor in [0, 1]public static long C(int n, int m)
n
- Number of elementsm
- Total of elementspublic static boolean equals(double real1, double real2)
real1
- First doublereal2
- Second doubletrue
if equalspublic static long factorial(int integer)
integer
- Integer to have is factorialpublic static int greaterCommonDivisor(int integer1, int integer2)
integer1
- First integerinteger2
- Second integerpublic static double interpolationExponential(double t)
t
- Value to interpolate in [0, 1]public static double interpolationLogarithm(double t)
t
- Value to interpolate in [0, 1]public static double interpolationSinus(double t)
t
- Value to interpolate in [0, 1]public static boolean isNul(double real)
real
- Double to testtrue
if zeropublic static int limit0_255(int integer)
integer
- Integer to limit in [0, 255]public static int lowerCommonMultiple(int integer1, int integer2)
integer1
- First integerinteger2
- Second integerpublic static final double max(double... doubles)
doubles
- Doubles to have the maximumpublic static final int maxIntegers(int... integers)
integers
- Integer to have the maximumpublic static final double min(double... doubles)
doubles
- Doubles to have the minimumpublic static final int minIntegers(int... integers)
integers
- Integer to have the minimumpublic static double modulo(double real, double modulo)
real
- Real to modulatemodulo
- Modulo to usepublic static int modulo(int integer, int modulo)
integer
- Integer to modulatemodulo
- Modulo to applyinteger[modulo]
public static long modulo(long integer, long modulo)
integer
- Integer to modulatemodulo
- Modulo to applyinteger[modulo]
public static double moduloInterval(double real, double min, double max)
real
- Real to modulatemin
- Minimum of intervalmax
- Maximum of intervalpublic static double PCubique(double cp, double p1, double p2, double p3, double t)
cp
- Start valuep1
- First control pointp2
- Second control pointp3
- Third control pointt
- Factor in [0, 1]public static double[] PCubiques(double cp, double p1, double p2, double p3, int precision, double[] cub)
cp
- Start valuep1
- First control pointp2
- Second control pointp3
- Third control pointprecision
- Number of interpolationcub
- Where write interpolationspublic static long pow(long integer, long pow)
Math.pow(double, double)
for some case.integer
- Integer to power ofpow
- Power to putpublic static double PQuadrique(double cp, double p1, double p2, double t)
cp
- Start valuep1
- First control pointp2
- Second control pointt
- Factor in [0, 1]public static double[] PQuadriques(double cp, double p1, double p2, int precision, double[] quad)
cp
- Start valuep1
- First control pointp2
- Second control pointprecision
- Number of interpolationquad
- Where write interpolationspublic static int sign(double real)
real
- Double to have its signpublic static final int sign(int integer)
-1 | If integer is <0 |
---|---|
0 | If integer is 0 |
1 | If integer is >0 |
integer
- Integer to have signpublic static int sign(long integer)
integer
- Integer to have its sign