java.lang.Object
committee.nova.mods.avaritia.api.util.math.MathUtils

public class MathUtils extends Object
Description:
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final double
     
    static final double
     
    static double[]
     
    static final double
     
    static final double
     
    static final double
     
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    static int
    absSum(net.minecraft.core.BlockPos pos)
     
    static double
    approachExp(double a, double b, double ratio)
     
    static double
    approachExp(double a, double b, double ratio, double cap)
     
    static int
    approachExpI(int a, int b, double ratio)
     
    static double
    approachLinear(double a, double b, double max)
     
    static float
    approachLinear(float a, float b, float max)
     
    static boolean
    between(double min, double value, double max)
     
    static int
    ceil(double d)
     
    static int
    ceil(float f)
     
    static double
    clip(double value, double min, double max)
     
    static float
    clip(float value, float min, float max)
     
    static int
    clip(int value, int min, int max)
     
    static int
    compare(double a, double b)
     
    static int
    compare(int a, int b)
     
    static double
    cos(double d)
     
    static int
    floor(double d)
     
    static int
    floor(float f)
     
    static net.minecraft.core.Direction
    getSide(net.minecraft.core.BlockPos pos)
     
    static double
    interpolate(double a, double b, double d)
     
    static float
    interpolate(float a, float b, float d)
     
    static boolean
    isAxial(net.minecraft.core.BlockPos pos)
     
    static double
    map(double valueIn, double inMin, double inMax, double outMin, double outMax)
    Maps a value range to another value range.
    static float
    map(float valueIn, float inMin, float inMax, float outMin, float outMax)
    Maps a value range to another value range.
    static net.minecraft.core.BlockPos
    max(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2)
     
    static net.minecraft.core.BlockPos
    min(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2)
     
    static double
    retreatExp(double a, double b, double c, double ratio, double kick)
     
    static int
    retreatExpI(int a, int b, int c, double ratio, int kick)
     
    static double
    round(double number, double multiplier)
    Rounds the number of decimal places based on the given multiplier.
    e.g.
    Input: 17.5245743
    multiplier: 1000
    Output: 17.534
    multiplier: 10
    Output 17.5

    static float
    round(float number, float multiplier)
    Rounds the number of decimal places based on the given multiplier.
    e.g.
    Input: 17.5245743
    multiplier: 1000
    Output: 17.534
    multiplier: 10
    Output 17.5

    static int
    roundAway(double d)
     
    static double
    sin(double d)
     
    static float
    sqrt(double f)
     
    static float
    sqrt(float f)
     
    static int
    toSide(net.minecraft.core.BlockPos pos)
     

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • phi

      public static final double phi
      另请参阅:
    • pi

      public static final double pi
      另请参阅:
    • todeg

      public static final double todeg
      另请参阅:
    • torad

      public static final double torad
      另请参阅:
    • sqrt2

      public static final double sqrt2
      另请参阅:
    • SIN_TABLE

      public static double[] SIN_TABLE
  • 构造器详细资料

    • MathUtils

      public MathUtils()
  • 方法详细资料

    • sin

      public static double sin(double d)
    • cos

      public static double cos(double d)
    • approachLinear

      public static float approachLinear(float a, float b, float max)
      参数:
      a - The value
      b - The value to approach
      max - The maximum step
      返回:
      the closed value to b no less than max from a
    • approachLinear

      public static double approachLinear(double a, double b, double max)
      参数:
      a - The value
      b - The value to approach
      max - The maximum step
      返回:
      the closed value to b no less than max from a
    • interpolate

      public static float interpolate(float a, float b, float d)
      参数:
      a - The first value
      b - The second value
      d - The interpolation factor, between 0 and 1
      返回:
      a+(b-a)*d
    • interpolate

      public static double interpolate(double a, double b, double d)
      参数:
      a - The first value
      b - The second value
      d - The interpolation factor, between 0 and 1
      返回:
      a+(b-a)*d
    • approachExp

      public static double approachExp(double a, double b, double ratio)
      参数:
      a - The value
      b - The value to approach
      ratio - The ratio to reduce the difference by
      返回:
      a+(b-a)*ratio
    • approachExp

      public static double approachExp(double a, double b, double ratio, double cap)
      参数:
      a - The value
      b - The value to approach
      ratio - The ratio to reduce the difference by
      cap - The maximum amount to advance by
      返回:
      a+(b-a)*ratio
    • retreatExp

      public static double retreatExp(double a, double b, double c, double ratio, double kick)
      参数:
      a - The value
      b - The value to approach
      ratio - The ratio to reduce the difference by
      c - The value to retreat from
      kick - The difference when a == c
      返回:
    • clip

      public static double clip(double value, double min, double max)
      参数:
      value - The value
      min - The min value
      max - The max value
      返回:
      The clipped value between min and max
    • clip

      public static float clip(float value, float min, float max)
      参数:
      value - The value
      min - The min value
      max - The max value
      返回:
      The clipped value between min and max
    • clip

      public static int clip(int value, int min, int max)
      参数:
      value - The value
      min - The min value
      max - The max value
      返回:
      The clipped value between min and max
    • map

      public static double map(double valueIn, double inMin, double inMax, double outMin, double outMax)
      Maps a value range to another value range.
      参数:
      valueIn - The value to map.
      inMin - The minimum of the input value range.
      inMax - The maximum of the input value range
      outMin - The minimum of the output value range.
      outMax - The maximum of the output value range.
      返回:
      The mapped value.
    • map

      public static float map(float valueIn, float inMin, float inMax, float outMin, float outMax)
      Maps a value range to another value range.
      参数:
      valueIn - The value to map.
      inMin - The minimum of the input value range.
      inMax - The maximum of the input value range
      outMin - The minimum of the output value range.
      outMax - The maximum of the output value range.
      返回:
      The mapped value.
    • round

      public static double round(double number, double multiplier)
      Rounds the number of decimal places based on the given multiplier.
      e.g.
      Input: 17.5245743
      multiplier: 1000
      Output: 17.534
      multiplier: 10
      Output 17.5

      参数:
      number - The input value.
      multiplier - The multiplier.
      返回:
      The input rounded to a number of decimal places based on the multiplier.
    • round

      public static float round(float number, float multiplier)
      Rounds the number of decimal places based on the given multiplier.
      e.g.
      Input: 17.5245743
      multiplier: 1000
      Output: 17.534
      multiplier: 10
      Output 17.5

      参数:
      number - The input value.
      multiplier - The multiplier.
      返回:
      The input rounded to a number of decimal places based on the multiplier.
    • between

      public static boolean between(double min, double value, double max)
      返回:
      min <= value <= max
    • approachExpI

      public static int approachExpI(int a, int b, double ratio)
    • retreatExpI

      public static int retreatExpI(int a, int b, int c, double ratio, int kick)
    • floor

      public static int floor(double d)
    • floor

      public static int floor(float f)
    • ceil

      public static int ceil(double d)
    • ceil

      public static int ceil(float f)
    • sqrt

      public static float sqrt(float f)
    • sqrt

      public static float sqrt(double f)
    • roundAway

      public static int roundAway(double d)
    • compare

      public static int compare(int a, int b)
    • compare

      public static int compare(double a, double b)
    • min

      public static net.minecraft.core.BlockPos min(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2)
    • max

      public static net.minecraft.core.BlockPos max(net.minecraft.core.Vec3i pos1, net.minecraft.core.Vec3i pos2)
    • absSum

      public static int absSum(net.minecraft.core.BlockPos pos)
    • isAxial

      public static boolean isAxial(net.minecraft.core.BlockPos pos)
    • toSide

      public static int toSide(net.minecraft.core.BlockPos pos)
    • getSide

      public static net.minecraft.core.Direction getSide(net.minecraft.core.BlockPos pos)