Class PZMath
java.lang.Object
zombie.core.math.PZMath
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final floatstatic final longstatic final longstatic final floatstatic final floatstatic final floatstatic final longstatic long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatabs(float val) static intabs(int val) static floatacosf(float a) static floatalmostIdentity(float x, float m, float n) static floatalmostUnitIdentity(float x) static floatangleBetween(float ax, float ay, float bx, float by) static floatangleBetween(Vector2 va, Vector2 vb) static floatangleBetweenNormalized(float ax, float bx, float ay, float by) static floatc_lerp(float src, float dest, float alpha) static floatcalculateBearing(Vector3 fromPosition, Vector2 fromForward, Vector3 toPosition) static booleancanParseFloat(String varStr) static floatceil(float val) static doubleclamp(double val, double min, double max) static floatclamp(float val, float min, float max) static intclamp(int val, int min, int max) static longclamp(long val, long min, long max) static floatclamp_01(float val) static doubleclampDouble_01(double val) static floatclampFloat(float val, float min, float max) static doubleclosestPointOnLineSegment(float x1, float y1, float x2, float y2, float px, float py, double endpointSnapEpsilon, org.joml.Vector2f out) static doubleclosestPointsOnLineSegments(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, org.joml.Vector2f p1, org.joml.Vector2f p2) static Vector3closestVector3(float lx0, float ly0, float lz0, float lx1, float ly1, float lz1, float x, float y, float z) static org.lwjgl.util.vector.Matrix4fconvertMatrix(org.joml.Matrix4f src, org.lwjgl.util.vector.Matrix4f dst) static org.joml.Matrix4fconvertMatrix(org.lwjgl.util.vector.Matrix4f src, org.joml.Matrix4f dst) static intcoorddivision(int value, int divisor) static intcoordmodulo(int value, int divisor) static floatcoordmodulof(float value, int divisor) static Vector3static floatdegToRad(float degrees) static booleanequal(float a, float b) static booleanequal(float a, float b, float delta) static intfastfloor(double val) static intfastfloor(float val) static doublefloor(double val) static floatfloor(float val) static floatfrac(float val) static floatgain(float x, float k) static floatgetClosestAngle(float radsA, float radsB) static floatgetClosestAngleDegrees(float degsA, float degsB) static floatgetLength(float x, float y) static floatgetLengthSq(float x, float y) static booleanintersectLineSegments(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, org.joml.Vector2f intersection) static booleanintersectLineSegments(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2, org.joml.Vector2f intersection) static booleanisBetween(float value, float min, float max) static floatisLeft(float x0, float y0, float x1, float y1, float x2, float y2) static booleanisNullOrZero(Vector2 vec) static floatlerp(float src, float dest, float alpha) static floatstatic org.lwjgl.util.vector.Vector3flerp(org.lwjgl.util.vector.Vector3f out, org.lwjgl.util.vector.Vector3f a, org.lwjgl.util.vector.Vector3f b, float t) static Vector2static Vector3static floatlerpAngle(float src, float dest, float alpha) static floatlerpFunc_EaseInQuad(float x) static floatlerpFunc_EaseOutInQuad(float x) static floatlerpFunc_EaseOutQuad(float x) static booleanlineSegmentsIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) static booleanlineSegmentsIntersect(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2) static floatmax(float a, float b) static floatmax(float a, float b, float c) static floatmax(float a, float b, float c, float d) static floatmax(float a, float b, float c, float d, float e) static intmax(int a, int b) static intmax(int a, int b, int c) static intmax(int a, int b, int c, int d) static intmax(int a, int b, int c, int d, int e) static floatmin(float a, float b) static floatmin(float a, float b, float c) static floatmin(float a, float b, float c, float d) static floatmin(float a, float b, float c, float d, float e) static intmin(int a, int b) static intmin(int a, int b, int c) static intmin(int a, int b, int c, int d) static intmin(int a, int b, int c, int d, int e) static intnextPowerOfTwo(int value) static float[]normalize(float[] weights) static <E> voidnormalize(E[] list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet) static <E> voidnormalize(List<E> list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet) static floatpow(float a, float b) static floatradToDeg(float radians) static org.lwjgl.util.vector.Vector3frotateVector(float vx, float vy, float vz, float qx, float qy, float qz, float qw, org.lwjgl.util.vector.Vector3f result) static Vector2rotateVector(float vx, float vy, float qx, float qy, float qz, float qw, Vector2 result) static org.lwjgl.util.vector.Vector3frotateVector(org.lwjgl.util.vector.Vector3f vector, org.lwjgl.util.vector.Quaternion quaternion, org.lwjgl.util.vector.Vector3f result) static floatroundFloat(float value, int scale) static floatroundFloatPos(float number, int scale) static floatroundFromEdges(float val) static introundToInt(float val) static floatroundToIntPlus05(float val) static floatroundToNearest(float val) static org.lwjgl.util.vector.QuaternionsetFromAxisAngle(float ax, float ay, float az, float angleRadians, org.lwjgl.util.vector.Quaternion result) static intsign(float val) static org.lwjgl.util.vector.Quaternionslerp(org.lwjgl.util.vector.Quaternion result, org.lwjgl.util.vector.Quaternion from, org.lwjgl.util.vector.Quaternion to, float alpha) static intsmallestEncompassingPowerOfTwo(int input) static floatsqrt(float val) static floatsquared(float a) static floatstep(float from, float to, float delta) static PZMath.SideOfLinetestSideOfLine(float x1, float y1, float x2, float y2, float px, float py) static doubletryParseDouble(String varStr, double defaultVal) static floattryParseFloat(String varStr, float defaultVal) static inttryParseInt(String varStr, int defaultVal) static floatwrap(float val, float range) static floatwrap(float val, float min, float max)
-
Field Details
-
PI
public static final float PI- See Also:
-
PI2
public static final float PI2- See Also:
-
halfPI
public static final float halfPI- See Also:
-
degToRads
public static final float degToRads- See Also:
-
radToDegs
public static final float radToDegs- See Also:
-
microsToNanos
public static final long microsToNanos- See Also:
-
millisToMicros
public static final long millisToMicros- See Also:
-
secondsToMillis
public static final long secondsToMillis- See Also:
-
secondsToNanos
public static long secondsToNanos
-
-
Constructor Details
-
PZMath
public PZMath()
-
-
Method Details
-
almostUnitIdentity
public static float almostUnitIdentity(float x) -
almostIdentity
public static float almostIdentity(float x, float m, float n) -
gain
public static float gain(float x, float k) -
clamp
public static float clamp(float val, float min, float max) -
clamp
public static long clamp(long val, long min, long max) -
clamp
public static int clamp(int val, int min, int max) -
clamp
public static double clamp(double val, double min, double max) -
clampFloat
public static float clampFloat(float val, float min, float max) -
clamp_01
public static float clamp_01(float val) -
clampDouble_01
public static double clampDouble_01(double val) -
setFromAxisAngle
public static org.lwjgl.util.vector.Quaternion setFromAxisAngle(float ax, float ay, float az, float angleRadians, org.lwjgl.util.vector.Quaternion result) -
lerp
public static float lerp(float src, float dest, float alpha) -
lerp
-
lerpAngle
public static float lerpAngle(float src, float dest, float alpha) -
lerp
public static org.lwjgl.util.vector.Vector3f lerp(org.lwjgl.util.vector.Vector3f out, org.lwjgl.util.vector.Vector3f a, org.lwjgl.util.vector.Vector3f b, float t) -
lerp
-
lerp
-
c_lerp
public static float c_lerp(float src, float dest, float alpha) -
slerp
public static org.lwjgl.util.vector.Quaternion slerp(org.lwjgl.util.vector.Quaternion result, org.lwjgl.util.vector.Quaternion from, org.lwjgl.util.vector.Quaternion to, float alpha) -
sqrt
public static float sqrt(float val) -
lerpFunc_EaseOutQuad
public static float lerpFunc_EaseOutQuad(float x) -
lerpFunc_EaseInQuad
public static float lerpFunc_EaseInQuad(float x) -
lerpFunc_EaseOutInQuad
public static float lerpFunc_EaseOutInQuad(float x) -
tryParseDouble
-
tryParseFloat
-
canParseFloat
-
tryParseInt
-
pow
public static float pow(float a, float b) -
squared
public static float squared(float a) -
degToRad
public static float degToRad(float degrees) -
radToDeg
public static float radToDeg(float radians) -
getClosestAngle
public static float getClosestAngle(float radsA, float radsB) -
getClosestAngleDegrees
public static float getClosestAngleDegrees(float degsA, float degsB) -
sign
public static int sign(float val) -
fastfloor
public static int fastfloor(double val) -
fastfloor
public static int fastfloor(float val) -
coorddivision
public static int coorddivision(int value, int divisor) -
coordmodulo
public static int coordmodulo(int value, int divisor) -
coordmodulof
public static float coordmodulof(float value, int divisor) -
floor
public static float floor(float val) -
floor
public static double floor(double val) -
ceil
public static float ceil(float val) -
frac
public static float frac(float val) -
wrap
public static float wrap(float val, float range) -
wrap
public static float wrap(float val, float min, float max) -
max
public static float max(float a, float b) -
max
public static float max(float a, float b, float c) -
max
public static float max(float a, float b, float c, float d) -
max
public static float max(float a, float b, float c, float d, float e) -
max
public static int max(int a, int b) -
max
public static int max(int a, int b, int c) -
max
public static int max(int a, int b, int c, int d) -
max
public static int max(int a, int b, int c, int d, int e) -
min
public static float min(float a, float b) -
min
public static float min(float a, float b, float c) -
min
public static float min(float a, float b, float c, float d) -
min
public static float min(float a, float b, float c, float d, float e) -
min
public static int min(int a, int b) -
min
public static int min(int a, int b, int c) -
min
public static int min(int a, int b, int c, int d) -
min
public static int min(int a, int b, int c, int d, int e) -
abs
public static float abs(float val) -
abs
public static int abs(int val) -
equal
public static boolean equal(float a, float b) -
equal
public static boolean equal(float a, float b, float delta) -
convertMatrix
public static org.lwjgl.util.vector.Matrix4f convertMatrix(org.joml.Matrix4f src, org.lwjgl.util.vector.Matrix4f dst) -
convertMatrix
public static org.joml.Matrix4f convertMatrix(org.lwjgl.util.vector.Matrix4f src, org.joml.Matrix4f dst) -
step
public static float step(float from, float to, float delta) -
angleBetween
-
angleBetween
public static float angleBetween(float ax, float ay, float bx, float by) -
angleBetweenNormalized
public static float angleBetweenNormalized(float ax, float bx, float ay, float by) -
acosf
public static float acosf(float a) -
calculateBearing
-
rotateVector
public static org.lwjgl.util.vector.Vector3f rotateVector(org.lwjgl.util.vector.Vector3f vector, org.lwjgl.util.vector.Quaternion quaternion, org.lwjgl.util.vector.Vector3f result) -
rotateVector
public static org.lwjgl.util.vector.Vector3f rotateVector(float vx, float vy, float vz, float qx, float qy, float qz, float qw, org.lwjgl.util.vector.Vector3f result) -
rotateVector
-
cross
-
getLength
public static float getLength(float x, float y) -
getLengthSq
public static float getLengthSq(float x, float y) -
isBetween
public static boolean isBetween(float value, float min, float max) -
isNullOrZero
-
smallestEncompassingPowerOfTwo
public static int smallestEncompassingPowerOfTwo(int input) -
testSideOfLine
public static PZMath.SideOfLine testSideOfLine(float x1, float y1, float x2, float y2, float px, float py) -
normalize
public static <E> void normalize(List<E> list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet) -
normalize
public static <E> void normalize(E[] list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet) -
normalize
public static float[] normalize(float[] weights) -
normalize
-
roundFloatPos
public static float roundFloatPos(float number, int scale) -
roundFloat
public static float roundFloat(float value, int scale) -
nextPowerOfTwo
public static int nextPowerOfTwo(int value) -
roundToNearest
public static float roundToNearest(float val) -
roundToInt
public static int roundToInt(float val) -
roundToIntPlus05
public static float roundToIntPlus05(float val) -
roundFromEdges
public static float roundFromEdges(float val) -
closestVector3
public static Vector3 closestVector3(float lx0, float ly0, float lz0, float lx1, float ly1, float lz1, float x, float y, float z) -
isLeft
public static float isLeft(float x0, float y0, float x1, float y1, float x2, float y2) -
intersectLineSegments
public static boolean intersectLineSegments(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, org.joml.Vector2f intersection) -
intersectLineSegments
public static boolean intersectLineSegments(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2, org.joml.Vector2f intersection) -
lineSegmentsIntersect
public static boolean lineSegmentsIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) -
lineSegmentsIntersect
public static boolean lineSegmentsIntersect(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2) -
closestPointOnLineSegment
public static double closestPointOnLineSegment(float x1, float y1, float x2, float y2, float px, float py, double endpointSnapEpsilon, org.joml.Vector2f out) -
closestPointsOnLineSegments
public static double closestPointsOnLineSegments(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, org.joml.Vector2f p1, org.joml.Vector2f p2)
-