Package dev.satyrn.papermc.api.util.v1
Class MathHelper
java.lang.Object
dev.satyrn.papermc.api.util.v1.MathHelper
Provides common math functions.
- Since:
- 1.5.0
- Author:
- Isabel Maskrey
-
Method Summary
Modifier and TypeMethodDescriptionstatic intclamp(int i, int min, int max) Clamps an integer between a min and max value.static doubleclampd(double d, double min, double max) Clamps a double between a min and max value.static floatclampf(float f, float min, float max) Clamps a float between a min and max value.static doublelogb(double value, double base) Gets the log of a value with the specified base.
-
Method Details
-
clampd
public static double clampd(double d, double min, double max) Clamps a double between a min and max value.- Parameters:
d- The double value.min- The minimum allowed value.max- The maximum allowed value.- Returns:
- The clamped result.
- Since:
- 1.5.0
-
clampf
public static float clampf(float f, float min, float max) Clamps a float between a min and max value.- Parameters:
f- The float value.min- The minimum allowed value.max- The maximum allowed value.- Returns:
- The clamped result.
- Since:
- 1.5.0
-
clamp
public static int clamp(int i, int min, int max) Clamps an integer between a min and max value.- Parameters:
i- The integer value.min- The minimum allowed value.max- The maximum allowed value.- Returns:
- The clamped result.
- Since:
- 1.5.0
-
logb
public static double logb(double value, double base) Gets the log of a value with the specified base.- Parameters:
value- The value.base- The base.- Returns:
- The resultant value.
- Since:
- 1.5.0
-