Maths
Public / Methods
Abs
4 overloads
Returns the absolute of the given value.
Returns the absolute of the given value.
Returns the absolute of the given value.
Returns the absolute of the given value.
Ceiling
4 overloads
Returns the smallest integer greater than or equal to the specified double-precision floating-point number.
Returns the smallest integer greater than or equal to the specified single-precision floating-point number.
Returns the smallest multiple of divisor in that is greater than or equal to value in.
Returns the smallest multiple of divisor in that is greater than or equal to value in.
Clamp
4 overloads
Clamps the given value.
Clamps the given value.
Clamps the given value.
Clamps the given value.
Div
2 overloads
Computes a / b
if b
is not 0
, returns c
otherwise.
Computes a / b
if b
is not 0
, returns c
otherwise.
FastFloor
2 overloads
Computes the integer floor value of the given double value.
Computes the integer floor value of the given float value.
Floor
4 overloads
Computes the floor value of the given value.
Computes the floor value of the given value.
Returns the greatest multiple of divisor in that is less than or equal to value in.
Returns the greatest multiple of divisor in that is less than or equal to value in.
IsNumber
Checks if the given floating point number is a regular number (i.e. neither nan nor infinity).
IsPowerOfTwo
2 overloads
Checks if the given value is a power of two.
A value v that satisfies the equation v = 2^n with 0 < n < 31 is said to be a power of two.
Checks if the given value is a power of two.
A value v that satisfies the equation v = 2^n with 0 < n < 31 is said to be a power of two.
Linear
Returns a linear function that passes through the given points.
This method computes the coefficients m
and b
of the linear function
f(x) = m * x + b
so that the following holds true:
f(ax) = ay f(bx) = by
Log2_Ceiling
Returns the discrete logarithm of base two of the given value.
The discrete logarithm of base two is computed as follows:
log2 := ceiling(log(v) / log(2))
Log2_Floor
Returns the discrete logarithm of base two of the given value.
The discrete logarithm of base two is computed as follows:
log2 := floor(log(v) / log(2))
Max
8 overloads
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Returns the maximum of the given values.
Min
8 overloads
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
Returns the minimum of the given values.
NextPowerOfTwo
Returns the smallest power of two that is greater than or equal to the given value.
Round
Rounds the given number.
The given value in is round to the nearest integral value, breaking ties in favour of the integral value that has the greater value:
-3 -2 -1 0 +1 +2 +3 input value . | . | . | . | . | . | . | . ------------------------------------------- [ -3 [ -2 [ -1 [ 0 [ +1 [ +2 [ +3 [ round value
Sign
4 overloads
Returns the sign of the given value.
Returns the sign of the given value.
Returns the sign of the given value.
Returns the sign of the given value.
Similar
2 overloads
Checks if the given floating-point values are similar.
Checks if the given floating-point values are similar.
SmootherStep
2 overloads
Applies a smoothstep function to the given value.
This method uses the following polynomial:
f(x) = 6 * x^5 - 15 * x^4 + 10 * x^3 f(0) = 0 f(1) = 1 f'(0) = f''(0) = f'(1) = f''(1) = 0 F(0.5) - F(0) = 0.5
Applies a smoothstep function to the given value.
This method uses the following polynomial:
f(x) = 6 * x^5 - 15 * x^4 + 10 * x^3 f(0) = 0 f(1) = 1 f'(0) = f''(0) = f'(1) = f''(1) = 0 F(0.5) - F(0) = 0.5
SplineCatmullRom
2 overloads
Computes the interpolation weights for a Catmull-Rom spline.
Mixes the first and second value using a Catmull-Rom spline.
SplineNonUniformB
Computes the interpolation factors for a Non-Uniform-B spline.
For an attribute array data
with defined operators for addition and multiplication, interpolation may be performed using the interpolation factors Vec4D.X, Vec4D.Y, Vec4D.Z and Vec4D.W as follows:
result = X * data[max(index - 1, start)] + Y * data[index] + Z * data[min(index + 1, end)] + W * data[min(index + 2, end)]
SplineUniformB
2 overloads
Computes the interpolation weights for a Uniform-B spline.
Mixes the first and second value using a Uniform-B spline.
Sqrt
2 overloads
Returns the square root of a specified number.
Returns the square root of a specified number.
Sqrt_Int
2 overloads
Computes the integer square root of the given value.
The integer square root is defined as floor(sqrt(v))
.
Computes the integer square root of the given value.
The integer square root is defined as floor(sqrt(v))
.
Truncate
2 overloads
Removes all fractional digits from the given number.
Removes all fractional digits from the given number.
Ulp
Returns the value that represents the unit in the last place (ULP) of the given value.
The ULP is defined as the regular number (see IsNumber) with the smallest possible absolute value (see Abs1) for which the following holds true:
v < v + ULP(v) v > v - ULP(v)
Special cases are treated as follows:
v == NaN <=> ULP(v) == NaN v == +Inf <=> ULP(v) == +Inf v == -Inf <=> ULP(v) == -Inf