public final class MathHelpers extends Object
| Modifier and Type | Field and Description |
|---|---|
static com.badlogic.gdx.math.Vector3 |
BACKWARD_VECTOR3 |
static float |
DOWN_2D |
static com.badlogic.gdx.math.Vector2 |
DOWN_VECTOR2 |
static com.badlogic.gdx.math.Vector3 |
DOWN_VECTOR3 |
static float |
EPSILON |
static float |
FLOAT_EPSILON |
static com.badlogic.gdx.math.Vector3 |
FORWARD_VECTOR3 |
static float |
LEFT_2D |
static com.badlogic.gdx.math.Vector2 |
LEFT_VECTOR2 |
static com.badlogic.gdx.math.Vector3 |
LEFT_VECTOR3 |
static float |
RIGHT_2D |
static com.badlogic.gdx.math.Vector2 |
RIGHT_VECTOR2 |
static com.badlogic.gdx.math.Vector3 |
RIGHT_VECTOR3 |
static float |
UP_2D |
static com.badlogic.gdx.math.Vector2 |
UP_VECTOR2 |
static com.badlogic.gdx.math.Vector3 |
UP_VECTOR3 |
| Constructor and Description |
|---|
MathHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areAlmostEqual(float a,
float b) |
static boolean |
areAlmostEqual(float a,
float b,
float tolerance) |
static boolean |
areAlmostEqual(float a,
float b,
float relativeTolerance,
float absoluteTolerance) |
static double |
fastInverseSqrt(double x) |
static float |
fastInverseSqrt(float x) |
static float |
getAngleBetween2D(com.badlogic.gdx.math.Vector2 a,
com.badlogic.gdx.math.Vector2 b) |
static float |
getAngleFromPointOnCircle(float x,
float y) |
static void |
getCartesianCoordsFromSpherical(float radius,
float inclination,
float azimuth,
com.badlogic.gdx.math.Vector3 result) |
static com.badlogic.gdx.math.Vector2 |
getDirectionVector2(float degrees) |
static void |
getDirectionVector2(float degrees,
com.badlogic.gdx.math.Vector2 result) |
static com.badlogic.gdx.math.Vector3 |
getDirectionVector3FromAngles(float yawDegrees,
float pitchDegrees) |
static void |
getDirectionVector3FromAngles(float yawDegrees,
float pitchDegrees,
com.badlogic.gdx.math.Vector3 result) |
static com.badlogic.gdx.math.Vector3 |
getDirectionVector3FromYAxis(float yAxisDegrees) |
static void |
getDirectionVector3FromYAxis(float yAxisDegrees,
com.badlogic.gdx.math.Vector3 result) |
static float |
getLowestQuadraticRoot(float a,
float b,
float c,
float maxR)
Basically the same as
com.badlogic.gdx.math.Intersector#getLowestPositiveRoot except for the addition
of a parameter maxR which limits the maximum root value we accept. |
static com.badlogic.gdx.math.Vector2 |
getPointOnCircle(float radius,
float degrees) |
static void |
getPointOnCircle(float radius,
float degrees,
com.badlogic.gdx.math.Vector2 result) |
static void |
getScaleFactor(com.badlogic.gdx.math.collision.BoundingBox originalSize,
com.badlogic.gdx.math.collision.BoundingBox desiredSize,
com.badlogic.gdx.math.Vector3 result) |
static void |
getScaleFactor(com.badlogic.gdx.math.Vector3 originalSize,
com.badlogic.gdx.math.Vector3 desiredSize,
com.badlogic.gdx.math.Vector3 result) |
static float |
getYAngleBetween(com.badlogic.gdx.math.Vector3 a,
com.badlogic.gdx.math.Vector3 b) |
static float |
inverseLerp(float a,
float b,
float lerpValue) |
static int |
inverseLerp(int a,
int b,
int lerpValue) |
static float |
lerp(float a,
float b,
float t) |
static int |
lerp(int a,
int b,
int t) |
static int |
pow(int number,
int power) |
static long |
pow(long number,
int power) |
static float |
rolloverClamp(float value,
float min,
float max) |
static int |
rolloverClamp(int value,
int min,
int max) |
static float |
scaleRange(float value,
float originalMin,
float originalMax,
float newMin,
float newMax) |
static int |
scaleRange(int value,
int originalMin,
int originalMax,
int newMin,
int newMax) |
static void |
setLengthOf(com.badlogic.gdx.math.Vector3 v,
float length) |
static float |
sign(float value) |
static int |
sign(int value) |
static float |
smoothStep(float low,
float high,
float t) |
public static final float FLOAT_EPSILON
public static final float EPSILON
public static final float UP_2D
public static final float DOWN_2D
public static final float LEFT_2D
public static final float RIGHT_2D
public static final com.badlogic.gdx.math.Vector2 UP_VECTOR2
public static final com.badlogic.gdx.math.Vector2 DOWN_VECTOR2
public static final com.badlogic.gdx.math.Vector2 LEFT_VECTOR2
public static final com.badlogic.gdx.math.Vector2 RIGHT_VECTOR2
public static final com.badlogic.gdx.math.Vector3 UP_VECTOR3
public static final com.badlogic.gdx.math.Vector3 DOWN_VECTOR3
public static final com.badlogic.gdx.math.Vector3 FORWARD_VECTOR3
public static final com.badlogic.gdx.math.Vector3 BACKWARD_VECTOR3
public static final com.badlogic.gdx.math.Vector3 LEFT_VECTOR3
public static final com.badlogic.gdx.math.Vector3 RIGHT_VECTOR3
public static void getDirectionVector2(float degrees,
com.badlogic.gdx.math.Vector2 result)
public static void getDirectionVector3FromYAxis(float yAxisDegrees,
com.badlogic.gdx.math.Vector3 result)
public static void getDirectionVector3FromAngles(float yawDegrees,
float pitchDegrees,
com.badlogic.gdx.math.Vector3 result)
public static float getYAngleBetween(com.badlogic.gdx.math.Vector3 a,
com.badlogic.gdx.math.Vector3 b)
public static float getAngleBetween2D(com.badlogic.gdx.math.Vector2 a,
com.badlogic.gdx.math.Vector2 b)
public static void getPointOnCircle(float radius,
float degrees,
com.badlogic.gdx.math.Vector2 result)
public static float getAngleFromPointOnCircle(float x,
float y)
public static void getCartesianCoordsFromSpherical(float radius,
float inclination,
float azimuth,
com.badlogic.gdx.math.Vector3 result)
public static boolean areAlmostEqual(float a,
float b)
public static boolean areAlmostEqual(float a,
float b,
float tolerance)
public static boolean areAlmostEqual(float a,
float b,
float relativeTolerance,
float absoluteTolerance)
public static float fastInverseSqrt(float x)
public static double fastInverseSqrt(double x)
public static int pow(int number,
int power)
public static long pow(long number,
int power)
public static int sign(int value)
public static float sign(float value)
public static float rolloverClamp(float value,
float min,
float max)
public static int rolloverClamp(int value,
int min,
int max)
public static float lerp(float a,
float b,
float t)
public static int lerp(int a,
int b,
int t)
public static float inverseLerp(float a,
float b,
float lerpValue)
public static int inverseLerp(int a,
int b,
int lerpValue)
public static float scaleRange(float value,
float originalMin,
float originalMax,
float newMin,
float newMax)
public static int scaleRange(int value,
int originalMin,
int originalMax,
int newMin,
int newMax)
public static float smoothStep(float low,
float high,
float t)
public static void getScaleFactor(com.badlogic.gdx.math.collision.BoundingBox originalSize,
com.badlogic.gdx.math.collision.BoundingBox desiredSize,
com.badlogic.gdx.math.Vector3 result)
public static void getScaleFactor(com.badlogic.gdx.math.Vector3 originalSize,
com.badlogic.gdx.math.Vector3 desiredSize,
com.badlogic.gdx.math.Vector3 result)
public static void setLengthOf(com.badlogic.gdx.math.Vector3 v,
float length)
public static float getLowestQuadraticRoot(float a,
float b,
float c,
float maxR)
com.badlogic.gdx.math.Intersector#getLowestPositiveRoot except for the addition
of a parameter maxR which limits the maximum root value we accept. Anything over this will also result
in a Float.NaN return value. A Float.NaN return means "no valid solution."public static com.badlogic.gdx.math.Vector2 getDirectionVector2(float degrees)
public static com.badlogic.gdx.math.Vector3 getDirectionVector3FromYAxis(float yAxisDegrees)
public static com.badlogic.gdx.math.Vector3 getDirectionVector3FromAngles(float yawDegrees,
float pitchDegrees)
public static com.badlogic.gdx.math.Vector2 getPointOnCircle(float radius,
float degrees)
Copyright © 2022. All rights reserved.