Class Calculator

java.lang.Object
com.hypixel.hytale.builtin.hytalegenerator.math.Calculator

public class Calculator extends Object
Math helpers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    distance(double x1, double y1, double x2, double y2)
    Returns the distance between two points.
    static double
    distance(double x1, double y1, double z1, double x2, double y2, double z2)
    Returns the distance between two points.
    static double
    linearInterpolation(double value0, double value1, double weight)
     
    static double
    max(double... n)
    Returns the highest value.
    static int
    max(int... n)
    Returns the largest value.
    static double
    min(double... n)
    Returns the lowest value.
    static int
    min(int... n)
    Returns the smallest value.
    static double
    smoothMax(double range, double a, double b)
    Returns the smooth maximum between two values given those values are within a certain range.
    static double
    smoothMin(double range, double a, double b)
    Returns the smooth minimum between two values given those values are within a certain range.
    static int
    stepFloor(int value, int stepSize)
     
    static int
    wrap(int value, int max)
     

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 1
      y1 - coordinate y of point 1
      z1 - coordinate z of point 1
      x2 - coordinate x of point 2
      y2 - coordinate y of point 2
      z2 - 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 1
      y1 - coordinate y of point 1
      x2 - coordinate x of point 2
      y2 - 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)