Class MqlMath

java.lang.Object
net.hollowcube.mql.runtime.MqlMath

public class MqlMath extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final MqlScope
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    abs(double value)
    Absolute value of value
    static double
    acos(double value)
    arccos of value
    static double
    asin(double value)
    arcsin of value
    static double
    atan(double value)
    arctan of value
    static double
    atan2(double y, double x)
    arctan of y/x.
    static double
    ceil(double value)
    Round value up to nearest integral number
    static double
    clamp(double value, double min, double max)
    Clamp value to between min and max inclusive
    static double
    cos(double value)
    Cosine (in degrees) of value
    static double
    dieRoll(double num, double low, double high)
    Returns the sum of 'num' random numbers, each with a value from low to high.
    static double
    dieRollInteger(double num, double low, double high)
    Returns the sum of 'num' random integer numbers, each with a value from low to high.
    static double
    exp(double value)
    Calculates e to the value 'nth' power
    static double
    floor(double value)
    Round value down to nearest integral number
    static double
    hermiteBlend(double value)
    Useful for simple smooth curve interpolation using one of the Hermite Basis functions: 3t^2 - 2t^3.
    static double
    lerp(double start, double end, double zeroToOne)
    Lerp from start to end via zeroToOne
    static double
    lerprotate(double start, double end, double zeroToOne)
    Lerp the shortest direction around a circle from start degrees to end degrees via zeroToOne
    static double
    ln(double value)
    Natural logarithm of value
    static double
    max(double a, double b)
    Return highest value of A or B
    static double
    min(double a, double b)
    Return lowest value of A or B
    static double
    minAngle(double value)
    Minimize angle magnitude (in degrees) into the range [-180, 180)
    static double
    mod(double value, double denominator)
    Return the remainder of value / denominator
    static double
    pi()
    Returns the float representation of the constant pi.
    static double
    pow(double base, double exponent)
    Elevates base to the exponent'th power
    static double
    random(double low, double high)
    Random value between low (inclusive) and high (exclusive)
    static double
    randomInteger(double low, double high)
    Random integer value between low and high (inclusive)
    static double
    round(double value)
    Round value to nearest integral number
    static double
    sin(double value)
    Sine (in degrees) of value
    static double
    sqrt(double value)
    Square root of value
    static double
    trunc(double value)
    Round value towards zero

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INSTANCE

      public static final MqlScope INSTANCE
  • Method Details

    • abs

      public static double abs(double value)
      Absolute value of value
    • acos

      public static double acos(double value)
      arccos of value
    • asin

      public static double asin(double value)
      arcsin of value
    • atan

      public static double atan(double value)
      arctan of value
    • atan2

      public static double atan2(double y, double x)
      arctan of y/x. NOTE: the order of arguments!
    • ceil

      public static double ceil(double value)
      Round value up to nearest integral number
    • clamp

      public static double clamp(double value, double min, double max)
      Clamp value to between min and max inclusive
    • cos

      public static double cos(double value)
      Cosine (in degrees) of value
    • dieRoll

      public static double dieRoll(double num, double low, double high)
      Returns the sum of 'num' random numbers, each with a value from low to high. Note: the generated random numbers are not integers like normal dice. For that, use math.die_roll_integer.
    • dieRollInteger

      public static double dieRollInteger(double num, double low, double high)
      Returns the sum of 'num' random integer numbers, each with a value from low to high. Note: the generated random numbers are integers like normal dice.
    • exp

      public static double exp(double value)
      Calculates e to the value 'nth' power
    • floor

      public static double floor(double value)
      Round value down to nearest integral number
    • hermiteBlend

      public static double hermiteBlend(double value)
      Useful for simple smooth curve interpolation using one of the Hermite Basis functions: 3t^2 - 2t^3. Note that while any valid float is a valid input, this function works best in the range [0,1].
    • lerp

      public static double lerp(double start, double end, double zeroToOne)
      Lerp from start to end via zeroToOne
    • lerprotate

      public static double lerprotate(double start, double end, double zeroToOne)
      Lerp the shortest direction around a circle from start degrees to end degrees via zeroToOne
    • ln

      public static double ln(double value)
      Natural logarithm of value
    • max

      public static double max(double a, double b)
      Return highest value of A or B
    • min

      public static double min(double a, double b)
      Return lowest value of A or B
    • minAngle

      public static double minAngle(double value)
      Minimize angle magnitude (in degrees) into the range [-180, 180)
    • mod

      public static double mod(double value, double denominator)
      Return the remainder of value / denominator
    • pi

      public static double pi()
      Returns the float representation of the constant pi.
    • pow

      public static double pow(double base, double exponent)
      Elevates base to the exponent'th power
    • random

      public static double random(double low, double high)
      Random value between low (inclusive) and high (exclusive)

      Note: The original molang spec says that the range is inclusive, but this high end is exclusive.

    • randomInteger

      public static double randomInteger(double low, double high)
      Random integer value between low and high (inclusive)
    • round

      public static double round(double value)
      Round value to nearest integral number
    • sin

      public static double sin(double value)
      Sine (in degrees) of value
    • sqrt

      public static double sqrt(double value)
      Square root of value
    • trunc

      public static double trunc(double value)
      Round value towards zero