Package com.plotsquared.core.util
Class MathMan
java.lang.Object
com.plotsquared.core.util.MathMan
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 specifiedstatic 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
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)
-
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
- yawpitch
- 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
- xy
- yz
- 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
-
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)
-