Contents
Class Calculator
java.lang.Object
com.hypixel.hytale.builtin.hytalegenerator.math.Calculator
Math helpers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledistance(double x1, double y1, double x2, double y2) Returns the distance between two points.static doubledistance(double x1, double y1, double z1, double x2, double y2, double z2) Returns the distance between two points.static doublelinearInterpolation(double value0, double value1, double weight) static doublemax(double... n) Returns the highest value.static intmax(int... n) Returns the largest value.static doublemin(double... n) Returns the lowest value.static intmin(int... n) Returns the smallest value.static doublesmoothMax(double range, double a, double b) Returns the smooth maximum between two values given those values are within a certain range.static doublesmoothMin(double range, double a, double b) Returns the smooth minimum between two values given those values are within a certain range.static intstepFloor(int value, int stepSize) static intwrap(int value, int max)
-
Constructor Details
-
Calculator
public Calculator()
-
-
Method Details
-
max
public static double max(@Nonnull double... n) Returns the highest value.- Parameters:
n- values to compare- Returns:
- largest value
-
min
public static double min(@Nonnull double... n) Returns the lowest value.- Parameters:
n- values to compare- Returns:
- smallest value
-
max
public static int max(@Nonnull int... n) Returns the largest value.- Parameters:
n- values to compare- Returns:
- largest value
-
min
public static int min(@Nonnull int... n) Returns the smallest value.- Parameters:
n- values to compare- Returns:
- smallest value
-
distance
public static double distance(double x1, double y1, double z1, double x2, double y2, double z2) Returns the distance between two points.- Parameters:
x1- coordinate x of point 1y1- coordinate y of point 1z1- coordinate z of point 1x2- coordinate x of point 2y2- coordinate y of point 2z2- coordinate z of point 2- Returns:
- the distance
-
distance
public static double distance(double x1, double y1, double x2, double y2) Returns the distance between two points.- Parameters:
x1- coordinate x of point 1y1- coordinate y of point 1x2- coordinate x of point 2y2- coordinate y of point 2- Returns:
- the distance
-
smoothMin
public static double smoothMin(double range, double a, double b) Returns the smooth minimum between two values given those values are within a certain range. The range must be greater or equal to 0. -
smoothMax
public static double smoothMax(double range, double a, double b) Returns the smooth maximum between two values given those values are within a certain range. The range must be greater or equal to 0. -
wrap
public static int wrap(int value, int max) -
stepFloor
public static int stepFloor(int value, int stepSize) -
linearInterpolation
public static double linearInterpolation(double value0, double value1, double weight)
-