liberty.math.functions

Public Imports

std.math
public import std.math;
Undocumented in source.

Members

Functions

clamp
T clamp(T x, T min, T max)

Clamp x in [min, max].

degrees
T degrees(T x)

Convert from radians to degrees.

fract
T fract(real x)

Returns fractional part of x.

ilog2
int ilog2(T i)

Integer log2.

inverseSqrt
T inverseSqrt(T x)

SSE approximation of reciprocal square root.

isPowerOf2
bool isPowerOf2(T i)

Returns true of i is a power of 2.

lerp
S lerp(S a, S b, T t)

Linear interpolation.

lfloor
long lfloor(real x)

Integer flooring.

ltrunc
long ltrunc(real x)

Integer truncation.

moduloWrap
T moduloWrap(T a, T b)

Signed integer modulo a/b where the remainder is guaranteed to be in [0..b], even if a is negative. Only supports positive dividers.

nextPowerOf2
int nextPowerOf2(int i)

Computes next power of 2.

nextPowerOf2
long nextPowerOf2(long i)

Computes next power of 2.

radians
T radians(T x)

Convert from degrees to radians.

safeAcos
T safeAcos(T x)

Safe acos. Input clamped to [-1, 1].

safeAsin
T safeAsin(T x)

Safe asin. Input clamped to [-1, 1].

sinOverX
T sinOverX(T x)

Computes sin(x)/x accurately.

smoothStep
T smoothStep(T a, T b, T t)
step
T step(T edge, T x)

If x < edge => 0.0 is returned, otherwise 1.0 is returned.

Meta

Source

See Source File
_functions.d Documentation: Coverage:

Authors

$(Gabriel Gheorghe)