public class MathHelper
extends java.lang.Object
修飾子とタイプ | フィールドと説明 |
---|---|
static float |
SQRT_2 |
コンストラクタと説明 |
---|
MathHelper() |
修飾子とタイプ | メソッドと説明 |
---|---|
static float |
abs(float value) |
static int |
abs(int value)
Returns the unsigned value of an int.
|
static int |
absFloor(double value) |
static double |
absMax(double x,
double y)
Maximum of the absolute value of two numbers.
|
static float |
approach(float p_203300_0_,
float p_203300_1_,
float p_203300_2_) |
static float |
approachDegrees(float p_203303_0_,
float p_203303_1_,
float p_203303_2_) |
static double |
atan2(double p_181159_0_,
double p_181159_2_) |
static double |
average(long[] values) |
static int |
binarySearch(int min,
int max,
java.util.function.IntPredicate isTargetBeforeOrAt) |
static int |
ceil(double value) |
static int |
ceil(float value) |
static double |
clamp(double num,
double min,
double max) |
static float |
clamp(float num,
float min,
float max)
Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and
third parameters
|
static int |
clamp(int num,
int min,
int max)
Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and
third parameters.
|
static long |
clamp(long num,
long min,
long max) |
static double |
clampedLerp(double lowerBnd,
double upperBnd,
double slide) |
static float |
cos(float value)
cos looked up in the sin table with the appropriate offset
|
static float |
degreesDifferenceAbs(float p_203301_0_,
float p_203301_1_) |
static boolean |
epsilonEquals(double x,
double y) |
static boolean |
epsilonEquals(float x,
float y) |
static int |
fastFloor(double value)
returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024
|
static float |
fastInvCubeRoot(float number) |
static double |
fastInvSqrt(double number)
Computes 1/sqrt(n) using the fast inverse square
root with a constant of 0x5FE6EB50C7B537AA.
|
static float |
fastInvSqrt(float number) |
static int |
floor(double value)
Returns the greatest integer less than or equal to the double argument
|
static int |
floor(float value)
Returns the greatest integer less than or equal to the float argument
|
static double |
frac(double number)
Gets the decimal portion of the given double.
|
static float |
frac(float number) |
static float |
func_219800_b(float p_219800_0_,
float p_219800_1_,
float p_219800_2_) |
static long |
getCoordinateRandom(int x,
int y,
int z) |
static double |
getDouble(java.lang.String value,
double defaultValue) |
static double |
getDouble(java.lang.String value,
double defaultValue,
double max) |
static int |
getInt(java.lang.String value,
int defaultValue)
parses the string as integer or returns the second parameter if it fails
|
static int |
getInt(java.lang.String value,
int defaultValue,
int max)
parses the string as integer or returns the second parameter if it fails. this value is capped to par2
|
static long |
getPositionRandom(Vec3i pos) |
static java.util.UUID |
getRandomUUID()
Generates a random UUID using the shared random
|
static java.util.UUID |
getRandomUUID(java.util.Random rand) |
static int |
hash(int p_188208_0_) |
static int |
hsvToRGB(float hue,
float saturation,
float value) |
static float |
interpolateAngle(float p_219805_0_,
float p_219805_1_,
float p_219805_2_) |
static int |
intFloorDiv(int x,
int y)
Buckets an integer with specifed bucket sizes.
|
static double |
lerp(double pct,
double start,
double end) |
static float |
lerp(float pct,
float start,
float end) |
static double |
lerp2(double p_219804_0_,
double p_219804_2_,
double p_219804_4_,
double p_219804_6_,
double p_219804_8_,
double p_219804_10_) |
static double |
lerp3(double p_219807_0_,
double p_219807_2_,
double p_219807_4_,
double p_219807_6_,
double p_219807_8_,
double p_219807_10_,
double p_219807_12_,
double p_219807_14_,
double p_219807_16_,
double p_219807_18_,
double p_219807_20_) |
static long |
lfloor(double value)
Long version of floor()
|
static int |
log2(int value)
Efficiently calculates the floor of the base-2 log of an integer value.
|
static int |
log2DeBruijn(int value)
Uses a B(2, 5) De Bruijn sequence and a lookup table to efficiently calculate the log-base-two of the given value.
|
static double |
nextDouble(java.util.Random random,
double minimum,
double maximum) |
static float |
nextFloat(java.util.Random random,
float minimum,
float maximum) |
static int |
nextInt(java.util.Random random,
int minimum,
int maximum) |
static int |
normalizeAngle(int x,
int y) |
static double |
pct(double p_181160_0_,
double p_181160_2_,
double p_181160_4_) |
static double |
perlinFade(double p_219801_0_) |
static double |
positiveModulo(double numerator,
double denominator) |
static float |
positiveModulo(float numerator,
float denominator) |
static int |
rgb(float rIn,
float gIn,
float bIn)
Makes an integer color from the given red, green, and blue float values
|
static int |
rgb(int rIn,
int gIn,
int bIn)
Makes a single int color with the given red, green, and blue values.
|
static float |
rotLerp(float p_226167_0_,
float p_226167_1_,
float p_226167_2_)
非推奨です。
|
static float |
rotWrap(double p_226168_0_)
非推奨です。
|
static int |
roundUp(int number,
int interval)
Rounds the first parameter up to the next interval of the second parameter.
|
static int |
signum(double x) |
static float |
sin(float value)
sin looked up in a table
|
static int |
smallestEncompassingPowerOfTwo(int value)
Returns the input value rounded up to the next highest power of two.
|
static float |
sqrt(double value) |
static float |
sqrt(float value) |
static double |
wrapDegrees(double value)
the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
|
static float |
wrapDegrees(float value)
the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
|
static int |
wrapDegrees(int angle)
Adjust the angle so that his value is in range [-180;180[
|
static float |
wrapSubtractDegrees(float p_203302_0_,
float p_203302_1_) |
public static float sin(float value)
public static float cos(float value)
public static float sqrt(float value)
public static float sqrt(double value)
public static int floor(float value)
public static int fastFloor(double value)
public static int floor(double value)
public static long lfloor(double value)
public static int absFloor(double value)
public static float abs(float value)
public static int abs(int value)
public static int ceil(float value)
public static int ceil(double value)
public static int clamp(int num, int min, int max)
public static long clamp(long num, long min, long max)
public static float clamp(float num, float min, float max)
public static double clamp(double num, double min, double max)
public static double clampedLerp(double lowerBnd, double upperBnd, double slide)
public static double absMax(double x, double y)
public static int intFloorDiv(int x, int y)
public static int nextInt(java.util.Random random, int minimum, int maximum)
public static float nextFloat(java.util.Random random, float minimum, float maximum)
public static double nextDouble(java.util.Random random, double minimum, double maximum)
public static double average(long[] values)
public static boolean epsilonEquals(float x, float y)
public static boolean epsilonEquals(double x, double y)
public static int normalizeAngle(int x, int y)
public static float positiveModulo(float numerator, float denominator)
public static double positiveModulo(double numerator, double denominator)
public static int wrapDegrees(int angle)
public static float wrapDegrees(float value)
public static double wrapDegrees(double value)
public static float wrapSubtractDegrees(float p_203302_0_, float p_203302_1_)
public static float degreesDifferenceAbs(float p_203301_0_, float p_203301_1_)
public static float func_219800_b(float p_219800_0_, float p_219800_1_, float p_219800_2_)
public static float approach(float p_203300_0_, float p_203300_1_, float p_203300_2_)
public static float approachDegrees(float p_203303_0_, float p_203303_1_, float p_203303_2_)
public static int getInt(java.lang.String value, int defaultValue)
public static int getInt(java.lang.String value, int defaultValue, int max)
public static double getDouble(java.lang.String value, double defaultValue)
public static double getDouble(java.lang.String value, double defaultValue, double max)
public static int smallestEncompassingPowerOfTwo(int value)
public static int log2DeBruijn(int value)
public static int log2(int value)
public static int roundUp(int number, int interval)
roundUp(1, 4)
returns 4; roundUp(0, 4)
returns 0; and roundUp(4, 4)
returns
4.public static int rgb(float rIn, float gIn, float bIn)
public static int rgb(int rIn, int gIn, int bIn)
public static float frac(float number)
public static double frac(double number)
frac(5.5)
returns .5
.public static long getPositionRandom(Vec3i pos)
public static long getCoordinateRandom(int x, int y, int z)
public static java.util.UUID getRandomUUID(java.util.Random rand)
public static java.util.UUID getRandomUUID()
public static double pct(double p_181160_0_, double p_181160_2_, double p_181160_4_)
public static double atan2(double p_181159_0_, double p_181159_2_)
public static float fastInvSqrt(float number)
public static double fastInvSqrt(double number)
public static float fastInvCubeRoot(float number)
public static int hsvToRGB(float hue, float saturation, float value)
public static int hash(int p_188208_0_)
public static int binarySearch(int min, int max, java.util.function.IntPredicate isTargetBeforeOrAt)
public static float lerp(float pct, float start, float end)
public static double lerp(double pct, double start, double end)
public static double lerp2(double p_219804_0_, double p_219804_2_, double p_219804_4_, double p_219804_6_, double p_219804_8_, double p_219804_10_)
public static double lerp3(double p_219807_0_, double p_219807_2_, double p_219807_4_, double p_219807_6_, double p_219807_8_, double p_219807_10_, double p_219807_12_, double p_219807_14_, double p_219807_16_, double p_219807_18_, double p_219807_20_)
public static double perlinFade(double p_219801_0_)
public static int signum(double x)
public static float interpolateAngle(float p_219805_0_, float p_219805_1_, float p_219805_2_)
@Deprecated public static float rotLerp(float p_226167_0_, float p_226167_1_, float p_226167_2_)
@Deprecated public static float rotWrap(double p_226168_0_)