Class MathUtils
- Namespace
- ValveResourceFormat.Renderer
- Assembly
- Renderer.dll
Common math utility functions for rendering and animation.
public static class MathUtilsInheritance
Inherited Members
Methods
Fract(float)
Returns the fractional part of a value (x - floor(x)).
public static float Fract(float x)Parameters
xfloat
Returns
LerpAngle(float, float, float)
Linearly interpolates between two angles in radians, taking the shortest path around the circle.
public static float LerpAngle(float from, float to, float amount)Parameters
fromfloat-
Start angle in radians.
tofloat-
End angle in radians.
amountfloat-
Interpolation weight (0.0 = from, 1.0 = to).
Returns
- float
-
Interpolated angle in radians.
MinMaxFixUp<T>(ref T, ref T)
Swaps min and max if min > max.
public static void MinMaxFixUp<T>(ref T min, ref T max) where T : INumber<T>Parameters
minTmaxT
Type Parameters
T
Remap(float, float, float)
Remaps a value from input range to 0-1.
public static float Remap(float x, float inputMin, float inputMax)Parameters
Returns
- float
-
Value remapped to 0-1 range.
RemapRange(float, float, float, float, float)
Remaps a value from one range to another.
public static float RemapRange(float x, float inputMin, float inputMax, float outputMin, float outputMax)Parameters
xfloat-
Value to remap.
inputMinfloat-
Input range minimum.
inputMaxfloat-
Input range maximum.
outputMinfloat-
Output range minimum.
outputMaxfloat-
Output range maximum.
Returns
- float
-
Value remapped to output range.
Saturate(float)
Clamps a value to [0, 1].
public static float Saturate(float x)Parameters
xfloat
Returns
Wrap(float, float, float)
Wraps a value within a range (modulo with offset).
public static float Wrap(float x, float lowBounds, float highBounds)