Class MathMan

java.lang.Object
com.plotsquared.core.util.MathMan

public class MathMan extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    atan2​(float y, float x)
     
    static int
    average​(int a, int b)
     
    static int
    floorMod​(int x, int y)
     
    static int
    gcd​(int[] a)
     
    static int
    gcd​(int a, int b)
     
    static float[]
    getDirection​(float yaw, float pitch)
    get the x,y,z unit vector from pitch and yaw specified
    static double
    getMean​(double[] array)
     
    static double
    getMean​(int[] array)
     
    static float[]
    getPitchAndYaw​(float x, float y, float z)
    Returns [ pitch, yaw ]
    static int
    getPositiveId​(int i)
     
    static double
    getSD​(double[] array, double av)
     
    static double
    getSD​(int[] array, double av)
     
    static long
    inverseRound​(double val)
     
    static float
    invSqrt​(float x)
     
    static boolean
    isInteger​(String str)
     
    static boolean
    isPowerOfTwo​(int number)
     
    static int
    mod​(int x, int y)
     
    static int
    pair​(short x, short y)
     
    static byte
    pair16​(byte x, byte y)
     
    static long
    pairInt​(int x, int y)
     
    static int
    roundInt​(double value)
     
    static int
    sqrt​(int x)
     
    static double
    sqrtApprox​(double d)
     
    static float
    sqrtApprox​(float f)
     
    static byte
    unpair16x​(byte value)
     
    static byte
    unpair16y​(byte value)
     
    static int
    unpairIntX​(long pair)
     
    static int
    unpairIntY​(long pair)
     
    static short
    unpairX​(int hash)
     
    static short
    unpairY​(int hash)
     
    static int
    unsignedmod​(int x, int y)
     

    Methods inherited from class java.lang.Object

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

    • MathMan

      public MathMan()
  • Method Details

    • gcd

      public static final int gcd(int a, int b)
    • gcd

      public static final int gcd(int[] a)
    • pairInt

      public static long pairInt(int x, int y)
    • unpairIntX

      public static int unpairIntX(long pair)
    • unpairIntY

      public static int unpairIntY(long pair)
    • pair16

      public static byte pair16(byte x, byte y)
    • unpair16x

      public static byte unpair16x(byte value)
    • unpair16y

      public static byte unpair16y(byte value)
    • inverseRound

      public static long inverseRound(double val)
    • sqrt

      public static int sqrt(int x)
    • getMean

      public static double getMean(int[] array)
    • getMean

      public static double getMean(double[] array)
    • pair

      public static int pair(short x, short y)
    • average

      public static final int average(int a, int b)
    • unpairX

      public static short unpairX(int hash)
    • unpairY

      public static short unpairY(int hash)
    • getDirection

      public static float[] getDirection(float yaw, float pitch)
      get the x,y,z unit vector from pitch and yaw specified
      Parameters:
      yaw - yaw
      pitch - pitch
      Returns:
      x, y, z unit vector
    • floorMod

      public static int floorMod(int x, int y)
    • roundInt

      public static int roundInt(double value)
    • getPitchAndYaw

      public static float[] getPitchAndYaw(float x, float y, float z)
      Returns [ pitch, yaw ]
      Parameters:
      x - x
      y - y
      z - z
      Returns:
      pitch and yaw of x,y,z from 0,0,0
    • atan2

      public static final float atan2(float y, float x)
    • sqrtApprox

      public static float sqrtApprox(float f)
    • sqrtApprox

      public static double sqrtApprox(double d)
    • invSqrt

      public static float invSqrt(float x)
    • getPositiveId

      public static int getPositiveId(int i)
    • isInteger

      public static boolean isInteger(String str)
    • getSD

      public static double getSD(double[] array, double av)
    • getSD

      public static double getSD(int[] array, double av)
    • mod

      public static int mod(int x, int y)
    • unsignedmod

      public static int unsignedmod(int x, int y)
    • isPowerOfTwo

      public static boolean isPowerOfTwo(int number)