Package xyz.gmitch215.socketmc.util.math
Class MathUtil
java.lang.Object
xyz.gmitch215.socketmc.util.math.MathUtil
A utility class for replicating math operations used in Minecraft.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
lerp
(double delta, double start, double end) Method for linear interpolation of doublesstatic float
lerp
(float delta, float start, float end) Method for linear interpolation of floatsstatic int
positiveCeilDiv
(int x, int y) Returns the smallest (closest to negative infinity) int value that is greater than or equal to the algebraic quotient.static int
roundToward
(int value, int factor) Rounds the given value up to a multiple of factor.
-
Method Details
-
lerp
public static float lerp(float delta, float start, float end) Method for linear interpolation of floats- Parameters:
delta
- A value usually between 0 and 1 that indicates the percentage of the lerp. (0 will give the start value and 1 will give the end value)start
- Start value for the lerpend
- End value for the lerp
-
lerp
public static double lerp(double delta, double start, double end) Method for linear interpolation of doubles- Parameters:
delta
- A value usually between 0 and 1 that indicates the percentage of the lerp. (0 will give the start value and 1 will give the end value)start
- Start value for the lerpend
- End value for the lerp
-
roundToward
public static int roundToward(int value, int factor) Rounds the given value up to a multiple of factor.- Returns:
- The smallest integer multiple of factor that is greater than or equal to the value
-
positiveCeilDiv
public static int positiveCeilDiv(int x, int y) Returns the smallest (closest to negative infinity) int value that is greater than or equal to the algebraic quotient.- See Also:
-