Package com.prineside.tdi2.utils
Class PMath
java.lang.Object
com.prineside.tdi2.utils.PMath
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Color
abgr8888ToColor
(int c) static Date
static int
addWithoutOverflow
(int left, int right) static boolean
circleIntersectsCircle
(float x1, float y1, float r1, float x2, float y2, float r2) static boolean
circleIntersectsCircleV
(Vector2 p1, float r1, Vector2 p2, float r2) static boolean
circleIntersectsRect
(float circleX, float circleY, float circleRadius, float rectX, float rectY, float rectWidth, float rectHeight) static boolean
compareFingerprints
(String tag, Enum[] e, byte[] data, Input input) static float
cos
(float radians) Returns the cosine in radians from a lookup table.static float
cosDeg
(float degrees) Returns the cosine in radians from a lookup table.static long
static float
getAngleBetweenPoints
(float x1, float y1, float x2, float y2) static float
getAngleBetweenPoints
(Vector2 pointOne, Vector2 pointTwo) static void
getBezierCurvePos
(Vector2 out, Vector2 start, Vector2 pivot, Vector2 end, float coeff) static int
getByChance
(RandomXS128 random, int[] chances, int arrayLength) static int
getByChance
(RandomXS128 random, IntArray chances) static float
getDistanceBetweenAngles
(float a, float b) static float
getDistanceBetweenPoints
(float x1, float y1, float x2, float y2) static float
getDistanceBetweenPoints
(Vector2 pointOne, Vector2 pointTwo) static boolean
getLineCircleIntersection
(Vector2 start, Vector2 end, Vector2 circleCenter, float circleSqrRadius, Vector2 hitPoint) static boolean
getLineCircleIntersectionFloats
(float startX, float startY, float endX, float endY, float circleCenterX, float circleCenterY, float circleSqrRadius, Vector2 hitPoint) static void
getPointByAngleFromPoint
(float x, float y, float angle, float distance, Vector2 out) static float
getSquareDistanceBetweenPoints
(float x1, float y1, float x2, float y2) static int
hash
(boolean v) static int
hash
(boolean[] v) static int
hash
(byte[] v) static int
hash
(double v) static int
hash
(float v) static int
hash
(float[] v) static int
hash
(int v) static int
hash
(int[] v) static int
hash
(long v) static int
static int
static int
static int
static int
static int
hashGameListeners
(ListenerGroup listeners) static void
interpolatePoint
(Vector2 point, Vector2 target, float coeff) static int
intHash
(byte[] v, int offset, int count) static boolean
isFinite
(double v) static boolean
isFinite
(float v) Float.isFinite but works on dumb iOSstatic float
loopedDistance
(float from, float to, float range) static int
multiplyWithoutOverflow
(int left, int right) static float
normalizeAngle
(float angle) static int
parseUnsignedInt
(String s, int radix) static float
randomTriangular
(RandomXS128 random) static float
randomTriangularMax
(float max, RandomXS128 random) static float
randomTriangularMinMax
(float min, float max, RandomXS128 random) static float
randomTriangularMinMaxMode
(float min, float max, float mode, RandomXS128 random) static void
removeArrayIndicesDirect
(Array<?> array, IntArray indices) static void
shiftPointByAngle
(Vector2 point, float angle, float distance) static float
sin
(float radians) Returns the sine in radians from a lookup table.static float
sinDeg
(float degrees) Returns the sine in radians from a lookup table.static String
toString
(int v) static boolean
willAdditionOverflow
(int left, int right) static boolean
willSubtractionOverflow
(int left, int right)
-
Constructor Details
-
PMath
public PMath()
-
-
Method Details
-
abgr8888ToColor
-
isFinite
public static boolean isFinite(float v) Float.isFinite but works on dumb iOS -
isFinite
public static boolean isFinite(double v) -
removeArrayIndicesDirect
- Parameters:
indices
- must be ordered descending (from higher to lower index)
-
sin
public static float sin(float radians) Returns the sine in radians from a lookup table. -
cos
public static float cos(float radians) Returns the cosine in radians from a lookup table. -
sinDeg
public static float sinDeg(float degrees) Returns the sine in radians from a lookup table. -
cosDeg
public static float cosDeg(float degrees) Returns the cosine in radians from a lookup table. -
generateNewId
public static long generateNewId() -
toString
-
getByChance
- Parameters:
chances
- массив по два значения (шанс - индекс)- Returns:
- индекс, который выпал
-
addDays
-
getByChance
- See Also:
-
loopedDistance
public static float loopedDistance(float from, float to, float range) -
randomTriangular
-
randomTriangularMax
-
randomTriangularMinMax
-
randomTriangularMinMaxMode
public static float randomTriangularMinMaxMode(float min, float max, float mode, RandomXS128 random) -
getBezierCurvePos
-
interpolatePoint
-
getDistanceBetweenPoints
public static float getDistanceBetweenPoints(float x1, float y1, float x2, float y2) -
getDistanceBetweenPoints
-
getSquareDistanceBetweenPoints
public static float getSquareDistanceBetweenPoints(float x1, float y1, float x2, float y2) -
normalizeAngle
public static float normalizeAngle(float angle) -
getAngleBetweenPoints
public static float getAngleBetweenPoints(float x1, float y1, float x2, float y2) -
getAngleBetweenPoints
-
getDistanceBetweenAngles
public static float getDistanceBetweenAngles(float a, float b) -
addWithoutOverflow
public static int addWithoutOverflow(int left, int right) -
multiplyWithoutOverflow
public static int multiplyWithoutOverflow(int left, int right) -
willAdditionOverflow
public static boolean willAdditionOverflow(int left, int right) -
willSubtractionOverflow
public static boolean willSubtractionOverflow(int left, int right) -
getPointByAngleFromPoint
public static void getPointByAngleFromPoint(float x, float y, float angle, float distance, Vector2 out) -
shiftPointByAngle
-
circleIntersectsRect
public static boolean circleIntersectsRect(float circleX, float circleY, float circleRadius, float rectX, float rectY, float rectWidth, float rectHeight) -
circleIntersectsCircle
public static boolean circleIntersectsCircle(float x1, float y1, float r1, float x2, float y2, float r2) -
circleIntersectsCircleV
-
getLineCircleIntersection
-
getLineCircleIntersectionFloats
public static boolean getLineCircleIntersectionFloats(float startX, float startY, float endX, float endY, float circleCenterX, float circleCenterY, float circleSqrRadius, Vector2 hitPoint) -
hash
public static int hash(int v) -
hash
public static int hash(float v) -
hash
public static int hash(long v) -
hash
-
hash
public static int hash(double v) -
hash
public static int hash(boolean v) -
hash
-
hash
-
hash
-
hash
public static int hash(boolean[] v) -
hash
public static int hash(byte[] v) -
hash
public static int hash(int[] v) -
hash
-
intHash
public static int intHash(byte[] v, int offset, int count) -
hash
public static int hash(float[] v) -
parseUnsignedInt
- Throws:
NumberFormatException
-
hashGameListeners
-
compareFingerprints
-