Class PZMath

java.lang.Object
zombie.core.math.PZMath

public final class PZMath extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
    static interface 
     
    static enum 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
     
    static final float
     
    static final long
     
    static final long
     
    static final float
     
    static final float
     
    static final float
     
    static final long
     
    static long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static float
    abs(float val)
     
    static int
    abs(int val)
     
    static float
    acosf(float a)
     
    static float
    almostIdentity(float x, float m, float n)
     
    static float
     
    static float
    angleBetween(float ax, float ay, float bx, float by)
     
    static float
     
    static float
    angleBetweenNormalized(float ax, float bx, float ay, float by)
     
    static float
    c_lerp(float src, float dest, float alpha)
     
    static float
    calculateBearing(Vector3 fromPosition, Vector2 fromForward, Vector3 toPosition)
     
    static boolean
     
    static float
    ceil(float val)
     
    static double
    clamp(double val, double min, double max)
     
    static float
    clamp(float val, float min, float max)
     
    static int
    clamp(int val, int min, int max)
     
    static long
    clamp(long val, long min, long max)
     
    static float
    clamp_01(float val)
     
    static double
    clampDouble_01(double val)
     
    static float
    clampFloat(float val, float min, float max)
     
    static double
    closestPointOnLineSegment(float x1, float y1, float x2, float y2, float px, float py, double endpointSnapEpsilon, org.joml.Vector2f out)
     
    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)
     
    static Vector3
    closestVector3(float lx0, float ly0, float lz0, float lx1, float ly1, float lz1, float x, float y, float z)
     
    static org.lwjgl.util.vector.Matrix4f
    convertMatrix(org.joml.Matrix4f src, org.lwjgl.util.vector.Matrix4f dst)
     
    static org.joml.Matrix4f
    convertMatrix(org.lwjgl.util.vector.Matrix4f src, org.joml.Matrix4f dst)
     
    static int
    coorddivision(int value, int divisor)
     
    static int
    coordmodulo(int value, int divisor)
     
    static float
    coordmodulof(float value, int divisor)
     
    static Vector3
     
    static float
    degToRad(float degrees)
     
    static boolean
    equal(float a, float b)
     
    static boolean
    equal(float a, float b, float delta)
     
    static int
    fastfloor(double val)
     
    static int
    fastfloor(float val)
     
    static double
    floor(double val)
     
    static float
    floor(float val)
     
    static float
    frac(float val)
     
    static float
    gain(float x, float k)
     
    static float
    getClosestAngle(float radsA, float radsB)
     
    static float
    getClosestAngleDegrees(float degsA, float degsB)
     
    static float
    getLength(float x, float y)
     
    static float
    getLengthSq(float x, float y)
     
    static boolean
    intersectLineSegments(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, org.joml.Vector2f intersection)
     
    static boolean
    intersectLineSegments(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2, org.joml.Vector2f intersection)
     
    static boolean
    isBetween(float value, float min, float max)
     
    static float
    isLeft(float x0, float y0, float x1, float y1, float x2, float y2)
     
    static boolean
     
    static float
    lerp(float src, float dest, float alpha)
     
    static float
    lerp(float src, float dest, float alpha, LerpType lerpType)
     
    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)
     
    static Vector2
    lerp(Vector2 out, Vector2 a, Vector2 b, float t)
     
    static Vector3
    lerp(Vector3 out, Vector3 a, Vector3 b, float t)
     
    static float
    lerpAngle(float src, float dest, float alpha)
     
    static float
     
    static float
     
    static float
     
    static boolean
    lineSegmentsIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
     
    static boolean
    lineSegmentsIntersect(org.joml.Vector2f p1, org.joml.Vector2f p2, org.joml.Vector2f q1, org.joml.Vector2f q2)
     
    static float
    max(float a, float b)
     
    static float
    max(float a, float b, float c)
     
    static float
    max(float a, float b, float c, float d)
     
    static float
    max(float a, float b, float c, float d, float e)
     
    static int
    max(int a, int b)
     
    static int
    max(int a, int b, int c)
     
    static int
    max(int a, int b, int c, int d)
     
    static int
    max(int a, int b, int c, int d, int e)
     
    static float
    min(float a, float b)
     
    static float
    min(float a, float b, float c)
     
    static float
    min(float a, float b, float c, float d)
     
    static float
    min(float a, float b, float c, float d, float e)
     
    static int
    min(int a, int b)
     
    static int
    min(int a, int b, int c)
     
    static int
    min(int a, int b, int c, int d)
     
    static int
    min(int a, int b, int c, int d, int e)
     
    static int
    nextPowerOfTwo(int value)
     
    static float[]
    normalize(float[] weights)
     
    static <E> void
    normalize(E[] list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet)
     
     
    static <E> void
    normalize(List<E> list, PZMath.FloatGet<E> floatGet, PZMath.FloatSet<E> floatSet)
     
    static float
    pow(float a, float b)
     
    static float
    radToDeg(float radians)
     
    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)
     
    static Vector2
    rotateVector(float vx, float vy, float qx, float qy, float qz, float qw, Vector2 result)
     
    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)
     
    static float
    roundFloat(float value, int scale)
     
    static float
    roundFloatPos(float number, int scale)
     
    static float
    roundFromEdges(float val)
     
    static int
    roundToInt(float val)
     
    static float
    roundToIntPlus05(float val)
     
    static float
    roundToNearest(float val)
     
    static org.lwjgl.util.vector.Quaternion
    setFromAxisAngle(float ax, float ay, float az, float angleRadians, org.lwjgl.util.vector.Quaternion result)
     
    static int
    sign(float val)
     
    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)
     
    static int
     
    static float
    sqrt(float val)
     
    static float
    squared(float a)
     
    static float
    step(float from, float to, float delta)
     
    testSideOfLine(float x1, float y1, float x2, float y2, float px, float py)
     
    static double
    tryParseDouble(String varStr, double defaultVal)
     
    static float
    tryParseFloat(String varStr, float defaultVal)
     
    static int
    tryParseInt(String varStr, int defaultVal)
     
    static float
    wrap(float val, float range)
     
    static float
    wrap(float val, float min, float max)
     

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public static float lerp(float src, float dest, float alpha, LerpType lerpType)
    • 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

      public static Vector3 lerp(Vector3 out, Vector3 a, Vector3 b, float t)
    • lerp

      public static Vector2 lerp(Vector2 out, Vector2 a, Vector2 b, float t)
    • 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

      public static double tryParseDouble(String varStr, double defaultVal)
    • tryParseFloat

      public static float tryParseFloat(String varStr, float defaultVal)
    • canParseFloat

      public static boolean canParseFloat(String varStr)
    • tryParseInt

      public static int tryParseInt(String varStr, int defaultVal)
    • 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

      public static float angleBetween(Vector2 va, Vector2 vb)
    • 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

      public static float calculateBearing(Vector3 fromPosition, Vector2 fromForward, Vector3 toPosition)
    • 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

      public static Vector2 rotateVector(float vx, float vy, float qx, float qy, float qz, float qw, Vector2 result)
    • cross

      public static Vector3 cross(Vector3 a, Vector3 b, Vector3 out)
    • 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

      public static boolean isNullOrZero(Vector2 vec)
    • 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

      public static ArrayList<Double> normalize(ArrayList<Double> list)
    • 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)