S&box Wiki


A class to add functionality to the math library that System.Math and System.MathF don't provide. A lot of these methods are also extensions, so you can use for example int i = 1.0f.FloorToInt();


static bool AlmostEqual( float value, float b, float within = 0.0001 )
static float Approach( float f, float target, float delta )
static int CeilToInt( float f )
static float Clamp( float v, float min, float max )
static float DegreeToRadian( float f )
static float Floor( float f )
static int FloorToInt( float f )
static float LerpInverse( float value, float a, float b, bool clamp = True )
static float LerpTo( float from, float to, float delta, bool clamp = True )
static float NormalizeDegrees( float degree )
Convert angle to between 0 - 360
static float RadianToDegree( float f )
static float SnapToGrid( float f, float gridSize )
Snap number to grid
static float UnsignedMod( float a, float b )
Does what you expected to happen when you did "a % b"