Class MathHelper

java.lang.Object
dev.satyrn.papermc.api.util.v1.MathHelper

public final class MathHelper extends Object
Provides common math functions.
Since:
1.5.0
Author:
Isabel Maskrey
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    clamp(int i, int min, int max)
    Clamps an integer between a min and max value.
    static double
    clampd(double d, double min, double max)
    Clamps a double between a min and max value.
    static float
    clampf(float f, float min, float max)
    Clamps a float between a min and max value.
    static double
    logb(double value, double base)
    Gets the log of a value with the specified base.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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