类 MathUtils
java.lang.Object
committee.nova.mods.avaritia.api.util.math.MathUtils
Description:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static intabsSum(net.minecraft.core.BlockPos pos) static doubleapproachExp(double a, double b, double ratio) static doubleapproachExp(double a, double b, double ratio, double cap) static intapproachExpI(int a, int b, double ratio) static doubleapproachLinear(double a, double b, double max) static floatapproachLinear(float a, float b, float max) static booleanbetween(double min, double value, double max) static intceil(double d) static intceil(float f) static doubleclip(double value, double min, double max) static floatclip(float value, float min, float max) static intclip(int value, int min, int max) static intcompare(double a, double b) static intcompare(int a, int b) static doublecos(double d) static intfloor(double d) static intfloor(float f) static net.minecraft.core.DirectiongetSide(net.minecraft.core.BlockPos pos) static doubleinterpolate(double a, double b, double d) static floatinterpolate(float a, float b, float d) static booleanisAxial(net.minecraft.core.BlockPos pos) static doublemap(double valueIn, double inMin, double inMax, double outMin, double outMax) Maps a value range to another value range.static floatmap(float valueIn, float inMin, float inMax, float outMin, float outMax) Maps a value range to another value range.static net.minecraft.core.BlockPosmax(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2) static net.minecraft.core.BlockPosmin(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2) static doubleretreatExp(double a, double b, double c, double ratio, double kick) static intretreatExpI(int a, int b, int c, double ratio, int kick) static doubleround(double number, double multiplier) Rounds the number of decimal places based on the given multiplier.
e.g.
Input: 17.5245743
multiplier: 1000
Output: 17.534
multiplier: 10
Output 17.5static floatround(float number, float multiplier) Rounds the number of decimal places based on the given multiplier.
e.g.
Input: 17.5245743
multiplier: 1000
Output: 17.534
multiplier: 10
Output 17.5static introundAway(double d) static doublesin(double d) static floatsqrt(double f) static floatsqrt(float f) static inttoSide(net.minecraft.core.BlockPos pos)
-
字段详细资料
-
构造器详细资料
-
MathUtils
public MathUtils()
-
-
方法详细资料
-
sin
public static double sin(double d) -
cos
public static double cos(double d) -
approachLinear
public static float approachLinear(float a, float b, float max) - 参数:
a- The valueb- The value to approachmax- The maximum step- 返回:
- the closed value to b no less than max from a
-
approachLinear
public static double approachLinear(double a, double b, double max) - 参数:
a- The valueb- The value to approachmax- The maximum step- 返回:
- the closed value to b no less than max from a
-
interpolate
public static float interpolate(float a, float b, float d) - 参数:
a- The first valueb- The second valued- The interpolation factor, between 0 and 1- 返回:
- a+(b-a)*d
-
interpolate
public static double interpolate(double a, double b, double d) - 参数:
a- The first valueb- The second valued- The interpolation factor, between 0 and 1- 返回:
- a+(b-a)*d
-
approachExp
public static double approachExp(double a, double b, double ratio) - 参数:
a- The valueb- The value to approachratio- The ratio to reduce the difference by- 返回:
- a+(b-a)*ratio
-
approachExp
public static double approachExp(double a, double b, double ratio, double cap) - 参数:
a- The valueb- The value to approachratio- The ratio to reduce the difference bycap- The maximum amount to advance by- 返回:
- a+(b-a)*ratio
-
retreatExp
public static double retreatExp(double a, double b, double c, double ratio, double kick) - 参数:
a- The valueb- The value to approachratio- The ratio to reduce the difference byc- The value to retreat fromkick- The difference when a == c- 返回:
-
clip
public static double clip(double value, double min, double max) - 参数:
value- The valuemin- The min valuemax- The max value- 返回:
- The clipped value between min and max
-
clip
public static float clip(float value, float min, float max) - 参数:
value- The valuemin- The min valuemax- The max value- 返回:
- The clipped value between min and max
-
clip
public static int clip(int value, int min, int max) - 参数:
value- The valuemin- The min valuemax- The max value- 返回:
- The clipped value between min and max
-
map
public static double map(double valueIn, double inMin, double inMax, double outMin, double outMax) Maps a value range to another value range.- 参数:
valueIn- The value to map.inMin- The minimum of the input value range.inMax- The maximum of the input value rangeoutMin- The minimum of the output value range.outMax- The maximum of the output value range.- 返回:
- The mapped value.
-
map
public static float map(float valueIn, float inMin, float inMax, float outMin, float outMax) Maps a value range to another value range.- 参数:
valueIn- The value to map.inMin- The minimum of the input value range.inMax- The maximum of the input value rangeoutMin- The minimum of the output value range.outMax- The maximum of the output value range.- 返回:
- The mapped value.
-
round
public static double round(double number, double multiplier) Rounds the number of decimal places based on the given multiplier.
e.g.
Input: 17.5245743
multiplier: 1000
Output: 17.534
multiplier: 10
Output 17.5- 参数:
number- The input value.multiplier- The multiplier.- 返回:
- The input rounded to a number of decimal places based on the multiplier.
-
round
public static float round(float number, float multiplier) Rounds the number of decimal places based on the given multiplier.
e.g.
Input: 17.5245743
multiplier: 1000
Output: 17.534
multiplier: 10
Output 17.5- 参数:
number- The input value.multiplier- The multiplier.- 返回:
- The input rounded to a number of decimal places based on the multiplier.
-
between
public static boolean between(double min, double value, double max) - 返回:
min <= value <= max
-
approachExpI
public static int approachExpI(int a, int b, double ratio) -
retreatExpI
public static int retreatExpI(int a, int b, int c, double ratio, int kick) -
floor
public static int floor(double d) -
floor
public static int floor(float f) -
ceil
public static int ceil(double d) -
ceil
public static int ceil(float f) -
sqrt
public static float sqrt(float f) -
sqrt
public static float sqrt(double f) -
roundAway
public static int roundAway(double d) -
compare
public static int compare(int a, int b) -
compare
public static int compare(double a, double b) -
min
public static net.minecraft.core.BlockPos min(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2) -
max
public static net.minecraft.core.BlockPos max(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2) -
absSum
public static int absSum(net.minecraft.core.BlockPos pos) -
isAxial
public static boolean isAxial(net.minecraft.core.BlockPos pos) -
toSide
public static int toSide(net.minecraft.core.BlockPos pos) -
getSide
public static net.minecraft.core.Direction getSide(net.minecraft.core.BlockPos pos)
-