public final class MathHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static float |
E
Represents the mathematical constant e.
|
static float |
Log10E
Represents the log base ten of e.
|
static float |
Log2E
Represents the log base two of e.
|
static float |
Pi
Represents the value of pi.
|
static float |
PiOver2
Represents the value of pi divided by two.
|
static float |
PiOver4
Represents the value of pi divided by four.
|
static float |
TwoPi
Represents the value of pi times two.
|
Modifier and Type | Method and Description |
---|---|
static float |
Barycentric(float value1,
float value2,
float value3,
float amount1,
float amount2)
Returns the Cartesian coordinate for one axis of a point that is defined by a given triangle and two normalized barycentric (areal) coordinates.
|
static float |
CatmullRom(float value1,
float value2,
float value3,
float value4,
float amount)
Performs a Catmull-Rom interpolation using the specified positions.
|
static float |
Clamp(float value,
float min,
float max)
Restricts a value to be within a specified range.
|
static float |
Distance(float value1,
float value2)
Calculates the absolute value of the difference of two values.
|
static float |
Hermite(float value1,
float tangent1,
float value2,
float tangent2,
float amount)
Performs a Hermite spline interpolation.
|
static float |
Lerp(float value1,
float value2,
float amount)
Linearly interpolates between two values.
|
static float |
Max(float value1,
float value2)
Returns the greater of two values.
|
static float |
Min(float value1,
float value2)
Returns the lesser of two values.
|
static float |
SmoothStep(float value1,
float value2,
float amount)
Interpolates between two values using a cubic equation.
|
static float |
ToDegrees(float radians)
Converts radians to degrees.
|
static float |
ToRadians(float degrees)
Converts degrees to radians.
|
static float |
WrapAngle(float angle)
Reduces a given angle to a value between π and -π.
|
public static final float E
public static final float Log10E
public static final float Log2E
public static final float Pi
public static final float PiOver2
public static final float PiOver4
public static final float TwoPi
public static float Barycentric(float value1, float value2, float value3, float amount1, float amount2)
value1
- The coordinate on one axis of vertex 1 of the defining triangle.value2
- The coordinate on the same axis of vertex 2 of the defining triangle.value3
- The coordinate on the same axis of vertex 3 of the defining triangle.amount1
- The normalized barycentric (areal) coordinate b2, equal to the weighting factor for vertex 2, the coordinate of which is specified in value2.amount2
- The normalized barycentric (areal) coordinate b3, equal to the weighting factor for vertex 3, the coordinate of which is specified in value3.public static float CatmullRom(float value1, float value2, float value3, float value4, float amount)
value1
- The first position in the interpolation.value2
- The second position in the interpolation.value3
- The third position in the interpolation.value4
- The fourth position in the interpolation.amount
- Weighting factor.public static float Clamp(float value, float min, float max)
value
- The value to clamp.min
- The minimum value. If value is less than min, min will be returned.max
- The maximum value. If value is greater than max, max will be returned.public static float Distance(float value1, float value2)
value1
- Source value.value2
- Source value.public static float Hermite(float value1, float tangent1, float value2, float tangent2, float amount)
value1
- Source position.tangent1
- Source tangent.value2
- Source position.tangent2
- Source tangent.amount
- Weighting factor.public static float Lerp(float value1, float value2, float amount)
value1
- Source value.value2
- Source value.amount
- Value between 0 and 1 indicating the weight of value2.public static float Max(float value1, float value2)
value1
- Source value.value2
- Source value.public static float Min(float value1, float value2)
value1
- Source value.value2
- Source value.public static float SmoothStep(float value1, float value2, float amount)
value1
- Source value.value2
- Source value.amount
- Weighting value.public static float ToDegrees(float radians)
public static float ToRadians(float degrees)
public static float WrapAngle(float angle)
angle
- The angle to reduce, in radians.