|
| 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. More...
|
| |
| static float | CatmullRom (float value1, float value2, float value3, float value4, float amount) |
| | Performs a Catmull-Rom interpolation using the specified positions. More...
|
| |
| static float | Clamp (float value, float min, float max) |
| | Restricts a value to be within a specified range. More...
|
| |
| static int | Clamp (int value, int min, int max) |
| | Restricts a value to be within a specified range. More...
|
| |
| static float | Distance (float value1, float value2) |
| | Calculates the absolute value of the difference of two values. More...
|
| |
| static float | Hermite (float value1, float tangent1, float value2, float tangent2, float amount) |
| | Performs a Hermite spline interpolation. More...
|
| |
| static float | Lerp (float value1, float value2, float amount) |
| | Linearly interpolates between two values. More...
|
| |
| static float | LerpPrecise (float value1, float value2, float amount) |
| | Linearly interpolates between two values. This method is a less efficient, more precise version of MathHelper.Lerp. See remarks for more info. More...
|
| |
| static float | Max (float value1, float value2) |
| | Returns the greater of two values. More...
|
| |
| static int | Max (int value1, int value2) |
| | Returns the greater of two values. More...
|
| |
| static float | Min (float value1, float value2) |
| | Returns the lesser of two values. More...
|
| |
| static int | Min (int value1, int value2) |
| | Returns the lesser of two values. More...
|
| |
| static float | SmoothStep (float value1, float value2, float amount) |
| | Interpolates between two values using a cubic equation. More...
|
| |
| static float | ToDegrees (float radians) |
| | Converts radians to degrees. More...
|
| |
| static float | ToRadians (float degrees) |
| | Converts degrees to radians. More...
|
| |
| static float | WrapAngle (float angle) |
| | Reduces a given angle to a value between π and -π. More...
|
| |
| static bool | IsPowerOfTwo (int value) |
| | Determines if value is powered by two. More...
|
| |
|
| const float | E = (float)Math.E |
| | Represents the mathematical constant e(2.71828175). More...
|
| |
| const float | Log10E = 0.4342945f |
| | Represents the log base ten of e(0.4342945). More...
|
| |
| const float | Log2E = 1.442695f |
| | Represents the log base two of e(1.442695). More...
|
| |
| const float | Pi = (float)Math.PI |
| | Represents the value of pi(3.14159274). More...
|
| |
| const float | PiOver2 = (float)(Math.PI / 2.0) |
| | Represents the value of pi divided by two(1.57079637). More...
|
| |
| const float | PiOver4 = (float)(Math.PI / 4.0) |
| | Represents the value of pi divided by four(0.7853982). More...
|
| |
| const float | TwoPi = (float)(Math.PI * 2.0) |
| | Represents the value of pi times two(6.28318548). More...
|
| |
Contains commonly used precalculated values and mathematical operations.
Definition at line 8 of file MathHelper.cs.
| static float Shift.MathHelper.Lerp |
( |
float |
value1, |
|
|
float |
value2, |
|
|
float |
amount |
|
) |
| |
|
inlinestatic |
Linearly interpolates between two values.
- Parameters
-
| value1 | Source value. |
| value2 | Destination value. |
| amount | Value between 0 and 1 indicating the weight of value2. |
- Returns
- Interpolated value.
This method performs the linear interpolation based on the following formula:
value1 + (value2 - value1) * amount
. Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned. See MathHelper.LerpPrecise for a less efficient version with more precision around edge cases.
Definition at line 166 of file MathHelper.cs.
| static float Shift.MathHelper.LerpPrecise |
( |
float |
value1, |
|
|
float |
value2, |
|
|
float |
amount |
|
) |
| |
|
inlinestatic |
Linearly interpolates between two values. This method is a less efficient, more precise version of MathHelper.Lerp. See remarks for more info.
- Parameters
-
| value1 | Source value. |
| value2 | Destination value. |
| amount | Value between 0 and 1 indicating the weight of value2. |
- Returns
- Interpolated value.
This method performs the linear interpolation based on the following formula:
((1 - amount) * value1) + (value2 * amount)
. Passing amount a value of 0 will cause value1 to be returned, a value of 1 will cause value2 to be returned. This method does not have the floating point precision issue that MathHelper.Lerp has. i.e. If there is a big gap between value1 and value2 in magnitude (e.g. value1=10000000000000000, value2=1), right at the edge of the interpolation range (amount=1), MathHelper.Lerp will return 0 (whereas it should return 1). This also holds for value1=10^17, value2=10; value1=10^18,value2=10^2... so on. For an in depth explanation of the issue, see below references: Relevant Wikipedia Article: https://en.wikipedia.org/wiki/Linear_interpolation#Programming_language_support Relevant StackOverflow Answer: http://stackoverflow.com/questions/4353525/floating-point-linear-interpolation#answer-23716956
Definition at line 192 of file MathHelper.cs.