Package com.prineside.tdi2.utils
Class PMath
java.lang.Object
com.prineside.tdi2.utils.PMath
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.badlogic.gdx.graphics.Colorabgr8888ToColor(int c) static Datestatic intaddWithoutOverflow(int left, int right) static LuaDoublecachedLuaDouble1(double val) static LuaDoublecachedLuaDouble2(double val) static booleancircleIntersectsCircle(float x1, float y1, float r1, float x2, float y2, float r2) static booleancircleIntersectsCircle(com.badlogic.gdx.math.Vector2 p1, float r1, com.badlogic.gdx.math.Vector2 p2, float r2) static booleancircleIntersectsRect(float circleX, float circleY, float circleRadius, float rectX, float rectY, float rectWidth, float rectHeight) static booleancompareFingerprints(String tag, Enum[] e, byte[] data, com.esotericsoftware.kryo.io.Input input) static voidcompareObjects(Object o1, Object o2, com.badlogic.gdx.utils.StringBuilder sb, com.badlogic.gdx.utils.Array<String> prefix, int depth, com.badlogic.gdx.utils.IntIntMap comparesMap, boolean debug) static voidcompareObjects(Object o1, Object o2, com.badlogic.gdx.utils.StringBuilder sb, com.badlogic.gdx.utils.Array<String> prefix, int depth, com.badlogic.gdx.utils.IntIntMap comparesMap, boolean debug, Enum[] keyEnum) static floatcos(float radians) Returns the cosine in radians from a lookup table.static floatcosDeg(float degrees) Returns the cosine in radians from a lookup table.static longstatic floatgetAngleBetweenPoints(float x1, float y1, float x2, float y2) static floatgetAngleBetweenPoints(com.badlogic.gdx.math.Vector2 pointOne, com.badlogic.gdx.math.Vector2 pointTwo) static voidgetBezierCurvePos(com.badlogic.gdx.math.Vector2 out, com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 pivot, com.badlogic.gdx.math.Vector2 end, float coeff) static intgetByChance(com.badlogic.gdx.math.RandomXS128 random, int[] chances, int arrayLength) static intgetByChance(com.badlogic.gdx.math.RandomXS128 random, com.badlogic.gdx.utils.IntArray chances) static floatgetDistanceBetweenAngles(float a, float b) static floatgetDistanceBetweenPoints(float x1, float y1, float x2, float y2) static floatgetDistanceBetweenPoints(com.badlogic.gdx.math.Vector2 pointOne, com.badlogic.gdx.math.Vector2 pointTwo) static booleangetLineCircleIntersection(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end, com.badlogic.gdx.math.Vector2 circleCenter, float circleSqrRadius, com.badlogic.gdx.math.Vector2 hitPoint) static com.badlogic.gdx.math.Vector2getPointByAngleFromPoint(float x, float y, float angle, float distance) static voidgetPointByAngleFromPoint(float x, float y, float angle, float distance, com.badlogic.gdx.math.Vector2 out) static floatgetSquareDistanceBetweenPoints(float x1, float y1, float x2, float y2) static inthash(boolean v) static inthash(boolean[] v) static inthash(byte[] v) static inthash(double v) static inthash(float v) static inthash(float[] v) static inthash(int v) static inthash(int[] v) static inthash(long v) static inthash(com.badlogic.gdx.math.Vector2 v) static inthash(com.badlogic.gdx.utils.Array[] v) static inthash(com.badlogic.gdx.utils.IntArray v) static intstatic intstatic inthashGameListeners(ListenerGroup listeners) static voidinterpolatePoint(com.badlogic.gdx.math.Vector2 point, com.badlogic.gdx.math.Vector2 target, float coeff) static intintHash(byte[] v, int offset, int count) static floatloopedDistance(float from, float to, float range) static intmultiplyWithoutOverflow(int left, int right) static floatnormalizeAngle(float angle) static intparseUnsignedInt(String s, int radix) static floatrandomTriangular(float min, float max, float mode, com.badlogic.gdx.math.RandomXS128 random) static floatrandomTriangular(float min, float max, com.badlogic.gdx.math.RandomXS128 random) static floatrandomTriangular(float max, com.badlogic.gdx.math.RandomXS128 random) static floatrandomTriangular(com.badlogic.gdx.math.RandomXS128 random) static voidremoveArrayIndicesDirect(com.badlogic.gdx.utils.Array<?> array, com.badlogic.gdx.utils.IntArray indices) static voidshiftPointByAngle(com.badlogic.gdx.math.Vector2 point, float angle, float distance) static floatsin(float radians) Returns the sine in radians from a lookup table.static floatsinDeg(float degrees) Returns the sine in radians from a lookup table.static StringtoString(int v) static booleanwillAdditionOverflow(int left, int right) static booleanwillSubtractionOverflow(int left, int right)
-
Constructor Details
-
PMath
public PMath()
-
-
Method Details
-
abgr8888ToColor
public static com.badlogic.gdx.graphics.Color abgr8888ToColor(int c) -
removeArrayIndicesDirect
public static void removeArrayIndicesDirect(com.badlogic.gdx.utils.Array<?> array, com.badlogic.gdx.utils.IntArray indices) - 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
-
cachedLuaDouble1
-
cachedLuaDouble2
-
getByChance
public static int getByChance(com.badlogic.gdx.math.RandomXS128 random, int[] chances, int arrayLength) - Parameters:
chances- массив по два значения (шанс - индекс)- Returns:
- индекс, который выпал
-
addDays
-
getByChance
public static int getByChance(com.badlogic.gdx.math.RandomXS128 random, com.badlogic.gdx.utils.IntArray chances) - See Also:
-
loopedDistance
public static float loopedDistance(float from, float to, float range) -
randomTriangular
public static float randomTriangular(com.badlogic.gdx.math.RandomXS128 random) -
randomTriangular
public static float randomTriangular(float max, com.badlogic.gdx.math.RandomXS128 random) -
randomTriangular
public static float randomTriangular(float min, float max, com.badlogic.gdx.math.RandomXS128 random) -
randomTriangular
public static float randomTriangular(float min, float max, float mode, com.badlogic.gdx.math.RandomXS128 random) -
getBezierCurvePos
public static void getBezierCurvePos(com.badlogic.gdx.math.Vector2 out, com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 pivot, com.badlogic.gdx.math.Vector2 end, float coeff) -
interpolatePoint
public static void interpolatePoint(com.badlogic.gdx.math.Vector2 point, com.badlogic.gdx.math.Vector2 target, float coeff) -
getDistanceBetweenPoints
public static float getDistanceBetweenPoints(float x1, float y1, float x2, float y2) -
getDistanceBetweenPoints
public static float getDistanceBetweenPoints(com.badlogic.gdx.math.Vector2 pointOne, com.badlogic.gdx.math.Vector2 pointTwo) -
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
public static float getAngleBetweenPoints(com.badlogic.gdx.math.Vector2 pointOne, com.badlogic.gdx.math.Vector2 pointTwo) -
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, com.badlogic.gdx.math.Vector2 out) -
getPointByAngleFromPoint
public static com.badlogic.gdx.math.Vector2 getPointByAngleFromPoint(float x, float y, float angle, float distance) -
shiftPointByAngle
public static void shiftPointByAngle(com.badlogic.gdx.math.Vector2 point, float angle, float distance) -
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) -
circleIntersectsCircle
public static boolean circleIntersectsCircle(com.badlogic.gdx.math.Vector2 p1, float r1, com.badlogic.gdx.math.Vector2 p2, float r2) -
getLineCircleIntersection
public static boolean getLineCircleIntersection(com.badlogic.gdx.math.Vector2 start, com.badlogic.gdx.math.Vector2 end, com.badlogic.gdx.math.Vector2 circleCenter, float circleSqrRadius, com.badlogic.gdx.math.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
public static int hash(com.badlogic.gdx.math.Vector2 v) -
hash
-
hash
public static int hash(com.badlogic.gdx.utils.Array[] v) -
hash
public static int hash(boolean[] v) -
hash
public static int hash(byte[] v) -
hash
public static int hash(int[] v) -
hash
public static int hash(com.badlogic.gdx.utils.IntArray v) -
intHash
public static int intHash(byte[] v, int offset, int count) -
hash
public static int hash(float[] v) -
parseUnsignedInt
- Throws:
NumberFormatException
-
hashGameListeners
-
compareFingerprints
-
compareObjects
-
compareObjects
-